package com.mosquito.project.exception;

import org.springframework.http.HttpStatus;
import java.util.HashMap;
import java.util.Map;

public class BusinessException extends RuntimeException {
    private HttpStatus status;
    private String errorCode;
    private Map<String, Object> details;

    public BusinessException(String message) {
        super(message);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = "BUSINESS_ERROR";
        this.details = new HashMap<>();
    }

    public BusinessException(String message, HttpStatus status) {
        super(message);
        this.status = status;
        this.errorCode = "BUSINESS_ERROR";
        this.details = new HashMap<>();
    }

    public BusinessException(String message, String errorCode) {
        super(message);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = errorCode;
        this.details = new HashMap<>();
    }

    public BusinessException(String message, HttpStatus status, String errorCode) {
        super(message);
        this.status = status;
        this.errorCode = errorCode;
        this.details = new HashMap<>();
    }

    public BusinessException(String message, Map<String, Object> details) {
        super(message);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = "BUSINESS_ERROR";
        this.details = details;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = "BUSINESS_ERROR";
        this.details = new HashMap<>();
    }

    public HttpStatus getStatus() { return status; }
    public String getErrorCode() { return errorCode; }
    public Map<String, Object> getDetails() { return details; }
}