package cn.iselab.mooctest.user.data;

import cn.iselab.mooctest.user.constants.ResponseStatus;

/**
 * @Author: xuexb
 * @Date: 2018.12.20 17:45
 */
public class ResponseResult<T> {

    private Integer status;     //响应状态
    private String msg;         //响应消息
    private T data;        //响应中的数据

    public ResponseResult(){
        this.status = ResponseStatus.SUCCESS;
        this.msg = "";
        this.data = null;
    }

    public ResponseResult(Integer status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public ResponseResult(T data) {
        this.status = ResponseStatus.SUCCESS;
        this.msg = "SUCCESS";
        this.data = data;
    }

    public ResponseResult(Integer status, String msg){
        this.status = status;
        this.msg = msg;
        this.data = null;
    }


    public void init(Integer status, String msg, T data){
        this.setData(data);
        this.setMsg(msg);
        this.setStatus(status);
    }

    public Integer getStatus() {
        return status;
    }

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

    public String getMsg() {
        return msg;
    }

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

    public Object getData() {
        return data;
    }

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