package com.nailart.vo;

import com.nailart.enums.RespCodeEnum;
import lombok.Data;

/**
 * @Description 所有的请求返回封装体
 * @Classname RespVO
 * @Date 2025/7/10 22:32
 * @Created by 21616
 */
@Data
public class RespVO {
    private Integer code;
    private String msg;
    private Object data;

    public static RespVO success() {
        RespVO respVO = new RespVO();
        respVO.setCode(RespCodeEnum.SUCCESS.getCode());
        respVO.setMsg(RespCodeEnum.SUCCESS.getMessage());
        return respVO;
    }
    public static RespVO success(Object data) {
        RespVO respVO = success();
        respVO.setData(data);
        return respVO;
    }
    public static RespVO error(RespCodeEnum respCodeEnum) {
        RespVO respVO = new RespVO();
        respVO.setCode(respCodeEnum.getCode());
        respVO.setMsg(respCodeEnum.getMessage());
        return respVO;
    }
    public static RespVO error(RespCodeEnum respCodeEnum, Object data) {
        RespVO respVO = error(respCodeEnum);
        respVO.setData(data);
        return respVO;
    }

}
