package com.ruoyi.system.yyinterface;

import java.io.Serializable;

public class ResultVO implements Serializable {

    private static final long serialVersionUID = -545712146633028245L;

    private boolean success;

    private String code;

    private String message;

    private Object data;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public ResultVO() {
        success = false;
    }

    public ResultVO(boolean success) {
        this.success = success;
    }

    public ResultVO(boolean success, Object data) {
        this.success = success;
        this.data = data;
    }


    public ResultVO(boolean success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = data;
    }


    public static ResultVO success() {
        ResultVO resultVO = new ResultVO();
        resultVO.setSuccess(true);
        resultVO.setCode("200");
        resultVO.setMessage("");
        resultVO.setData(null);
        return resultVO;
    }

    public static ResultVO success(String errorCode, String errMsg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setSuccess(true);
        resultVO.setCode(errorCode);
        resultVO.setMessage(errMsg);
        resultVO.setData(null);
        return resultVO;
    }

    public static ResultVO success(Object data) {
        ResultVO resultVO = new ResultVO();
        resultVO.setSuccess(true);
        resultVO.setCode("200");
        resultVO.setMessage("");
        resultVO.setData(data);
        return resultVO;
    }

    public static ResultVO serverErr(String errMsg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setSuccess(false);
        resultVO.setCode("500");
        resultVO.setMessage(errMsg);
        resultVO.setData(null);
        return resultVO;
    }



    public static ResultVO serverErr(String errorCode, String errMsg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setSuccess(false);
        resultVO.setCode(errorCode);
        resultVO.setMessage(errMsg);
        resultVO.setData(null);
        return resultVO;
    }
}

