package com.xueyi.common.web.response;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.web.result.R;

import java.io.Serializable;
import java.util.HashMap;

public class MyResponse implements Serializable {
    private static final long serialVersionUID = 1L;
    private Integer status;
    private String errMsg;
    private Object data;

    public MyResponse() {
    }

    public MyResponse(Integer status) {
        this.status = status;
        this.errMsg = "";
        this.data = new HashMap();
    }

    public MyResponse(Integer status, String errMsg) {
        this.status = status;
        this.errMsg = errMsg;
        this.data = new HashMap();
    }

    public MyResponse(Integer status, String errMsg, Object data) {
        this.status = status;
        this.errMsg = errMsg;
        this.data = data;
    }

    public Integer getStatus() {
        return this.status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getErrMsg() {
        return this.errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public Object getData() {
        return this.data;
    }

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


    public R<JSONObject> toRJSON() {
        JSONObject json = new JSONObject();
        json.put("status", this.status);
        json.put("err", this.errMsg);
        json.put("data", this.data);
        return R.ok(json);
    }

    public JSONObject toJSON() {
        JSONObject json = new JSONObject();
        json.put("status", this.status);
        json.put("err", this.errMsg);
        json.put("data", this.data);
        return json;
    }

    public com.alibaba.fastjson.JSONObject toJSON1() {
        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
        json.put("status", this.status);
        json.put("err", this.errMsg);
        json.put("data", this.data);
        return json;
    }
}

