package com.neusoft.smart.pos.framework.dto;

import com.neusoft.smart.pos.framework.constants.CommonErrorCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @author zcf
 * @date 2017-08-13 10：43
 * @description 公共数据返回对象
 */
@ApiModel
public class ResponseData<T> {

    @ApiModelProperty(name = "code", value = "返回码", required = true, dataType = "String",example="0")
    private String code;

    @ApiModelProperty(name = "message", value = "描述", required = true, dataType = "String",example="success")
    private String message;

    @ApiModelProperty(name = "result", value = "响应数据", required = true,example="")
    private T result;

    public ResponseData() {
        this.code = CommonErrorCode.SUCCESS.getCode();
        this.message = CommonErrorCode.SUCCESS.getMessage();
    }

    public ResponseData(T result) {
        this.code = CommonErrorCode.SUCCESS.getCode();
        this.message = CommonErrorCode.SUCCESS.getMessage();
        this.result = result;
    }

    public ResponseData(String code, String message) {
        this.code = code;
        this.message = message;
        this.result = null;
    }

    public ResponseData(String code, String message, T result) {
        this.code = code;
        this.message = message;
        this.result = result;
    }

    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 T getResult() {
		return result;
	}

	public void setResult(T result) {
		this.result = result;
	}

}
