package com.red.circle.other.app.dto.cmd.party3rd;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Yomi统一响应包装
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class YomiResponseWrapper<T> {
    
    /**
     * 状态码 200=成功
     */
    private Integer code;
    
    /**
     * 消息
     */
    private String message;
    
    /**
     * 数据
     */
    private T data;
    
    public static <T> YomiResponseWrapper<T> success(T data) {
        return new YomiResponseWrapper<>(200, "success", data);
    }
    
    public static <T> YomiResponseWrapper<T> fail(Integer code, String message) {
        return new YomiResponseWrapper<>(code, message, null);
    }
}