package com.sy.coinage.core.resp;

import java.io.Serializable;

import com.sy.coinage.core.constants.ResponseEnum;

/**
 * -通用返回实体
 */
public class ReturnJson implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;
    /**
     * 文字描述
     */
    private String msg;
    /**
     * 响应状态码
     */
    private Integer code;
    /**
     * 响应内容
     */
    private Object retObj;
    /**
     * 响应状态
     */
    private boolean success;

    public final static ReturnJson Success =
                    new ReturnJson(ResponseEnum.SUCCESS.getMsg(), ResponseEnum.SUCCESS.value(), null, true);
    public final static ReturnJson Faild =
                    new ReturnJson(ResponseEnum.FAILED.getMsg(), ResponseEnum.FAILED.value(), null, false);

    public ReturnJson() {
        super();
    }

    public ReturnJson(String msg, int code, Object retObj, boolean success) {
        super();
        this.msg = msg;
        this.code = code;
        this.retObj = retObj;
        this.success = success;
    }

    public ReturnJson(Object retObj) {
        super();
        this.msg = ResponseEnum.SUCCESS.getMsg();
        this.code = ResponseEnum.SUCCESS.value();
        this.retObj = retObj;
        this.success = true;
    }

    public ReturnJson(String msg, Object retObj) {
        super();
        this.msg = msg;
        this.code = ResponseEnum.SUCCESS.value();
        this.retObj = retObj;
        this.success = true;
    }

    public ReturnJson(String msg, boolean success) {
        super();
        this.msg = msg;
        this.code = ResponseEnum.SUCCESS.value();
        this.retObj = null;
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

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

    public Object getRetObj() {
        return retObj;
    }

    public void setRetObj(Object retObj) {
        this.retObj = retObj;
    }

    public boolean isSuccess() {
        return success;
    }

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

}
