package com.njcn.common.pojo.response;

import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.Serializable;

/**
 * @author hongawen
 * @version 1.0.0
 * @date  2021年03月25日 15:38
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class HttpResult<T> implements Serializable {

    /**状态码*/
    private String code;

    /**回执信息*/
    private String message;

    /**响应数据*/
    private T data;

    public HttpResult(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public HttpResult(Integer code, String message) {
        this.code = String.valueOf(code);
        this.message = message;
    }

    public HttpResult(T content) {
        this.code = CommonResponseEnum.SUCCESS.getCode();
        this.data = content;
    }
}
