package com.jsowell.common.response;

import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import lombok.Data;

@Data
public class RestApiResponse<T> {
	/**
	 * 返回码
	 */
	private String resCode;

	/**
	 * 信息
	 */
	private String msg;

	/**
	 * 数据
	 */
	private T obj;

	public RestApiResponse() {
		this.resCode = ReturnCodeEnum.CODE_SUCCESS.getValue();
		this.msg = ReturnCodeEnum.CODE_SUCCESS.getLabel();
	}

	public RestApiResponse(T t) {
		this.resCode = ReturnCodeEnum.CODE_SUCCESS.getValue();
		this.msg = ReturnCodeEnum.CODE_SUCCESS.getLabel();
		this.obj = t;
	}

	public RestApiResponse(String resCode, String msg) {
		this.resCode = resCode;
		this.msg = msg;
	}

	public RestApiResponse(ReturnCodeEnum returnCodeEnum) {
		this.resCode = returnCodeEnum.getValue();
		this.msg = returnCodeEnum.getLabel();
	}
}
