package online.wesal.wesal.dto;

public class ApiResponse<T> {
    
    private boolean status;
    private String message;
    private T data;
    
    public ApiResponse() {}
    
    public ApiResponse(boolean status) {
        this.status = status;
    }
    
    public ApiResponse(boolean status, String message) {
        this.status = status;
        this.message = message;
    }
    
    public ApiResponse(boolean status, T data) {
        this.status = status;
        this.data = data;
    }
    
    public ApiResponse(boolean status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }
    
    public static <T> ApiResponse<T> success(T data) {
        return new ApiResponse<>(true, data);
    }
    
    public static <T> ApiResponse<T> error(String message) {
        return new ApiResponse<>(false, message);
    }
    
    public boolean isStatus() {
        return status;
    }
    
    public void setStatus(boolean status) {
        this.status = status;
    }
    
    public String getMessage() {
        return message;
    }
    
    public void setMessage(String message) {
        this.message = message;
    }
    
    public T getData() {
        return data;
    }
    
    public void setData(T data) {
        this.data = data;
    }
}