package com.zcxk.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * Ajax信息
 *
 */
@ApiModel("返回信息")
public class AjaxMessage<T> {

    @ApiModelProperty(value = "返回状态", position = 0)
    private int status;
    @ApiModelProperty(value = "返回信息", position = 1)
    private String msg;
    @ApiModelProperty(value = "返回内容", position = 2)
    private T data;

    public AjaxMessage() {
    }

    public AjaxMessage(int status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public AjaxMessage(ResultStatus resultStatus, T data) {
        this.status = resultStatus.getStatus();
        this.msg = resultStatus.getMessage();
        this.data = data;
    }

    public AjaxMessage(ResultStatus resultStatus) {
        this.status = resultStatus.getStatus();
        this.msg = resultStatus.getMessage();
    }



    public void setMsg(int status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }


    public int getStatus() {
        return status;
    }

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

    public String getMsg() {
        return msg;
    }

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

    public T getData() {
        return data;
    }

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

    public void setMsg(int status, String msg) {
        this.status = status;
        this.msg = msg;
        this.data = null;
    }

    public void setMsg(ResultStatus resultStatus, T data) {
        this.status = resultStatus.getStatus();
        this.msg = resultStatus.getMessage();;
        this.data = data;
    }

    public void setMsg(ResultStatus resultStatus) {
        this.status = resultStatus.getStatus();
        this.msg = resultStatus.getMessage();;
        this.data = null;
    }


}
