package thyyxxk.webserver.entity;

import lombok.Data;
import thyyxxk.webserver.config.exception.ExceptionEnum;

/**
 * @author dj
 */
@Data
public class ResultVo<T> {
    private Integer code;
    private String message;
    private T data;


    public ResultVo() {
        this.code = ExceptionEnum.SUCCESS.getCode();
        this.message = ExceptionEnum.SUCCESS.getMessage();
    }

    public ResultVo(T data) {
        this.code = ExceptionEnum.SUCCESS.getCode();
        this.message = ExceptionEnum.SUCCESS.getMessage();
        this.data = data;
    }


    public ResultVo(ExceptionEnum exceptionEnum) {
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
    }

    public ResultVo(ExceptionEnum exceptionEnum, String message) {
        this.code = exceptionEnum.getCode();
        this.message = message;
    }

    public ResultVo(ExceptionEnum exceptionEnum, T data) {
        this.code = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
        this.data = data;
    }

    public ResultVo(ExceptionEnum exceptionEnum, String message, T data) {
        this.code = exceptionEnum.getCode();
        this.message = message;
        this.data = data;
    }
}
