package com.example.system.common;
/**
 * 通用响应结果类
 */
public class AiResult<T> {
    private Integer code;
    private String message;
    private T data;

    private AiResult(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> AiResult<T> success(T data) {
        return new AiResult<>(200, "操作成功", data);
    }

    public static <T> AiResult<T> success(T data, String message) {
        return new AiResult<>(200, message, data);
    }

    public static <T> AiResult<T> error(String message) {
        return new AiResult<>(500, message, null);
    }

    public static <T> AiResult<T> error(Integer code, String message) {
        return new AiResult<>(code, message, null);
    }

    // Getter 方法
    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public T getData() {
        return data;
    }
}
