package com.ruoyi.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class SimpleResult {
    private String statusCode;
    private Object data;
    private String message;
    public static SimpleResult simpleResult = new SimpleResult();

    public static SimpleResult success(Object data, String message){
        simpleResult.setStatusCode("200");
        simpleResult.setData(data);
        simpleResult.setMessage(message);
        return simpleResult;
    }

    public static SimpleResult success(Object data){
        simpleResult.setStatusCode("200");
        simpleResult.setData(data);
        simpleResult.setMessage(null);
        return simpleResult;
    }

    public static SimpleResult success(String message){
        simpleResult.setStatusCode("200");
        simpleResult.setData(null);
        simpleResult.setMessage(message);
        return simpleResult;
    }

    public static SimpleResult error(String message){
        simpleResult.setStatusCode("404");
        simpleResult.setData(null);
        simpleResult.setMessage(message);
        return simpleResult;
    }

    public static SimpleResult simple(Object data, String message, String code){
        simpleResult.setStatusCode(code);
        simpleResult.setData(data);
        simpleResult.setMessage(message);
        return simpleResult;
    }
}
