package com.njcn.relational.pojo.vo;

/**
 * @Author: cdf
 * @CreateTime: 2026-06-28
 * @Description:
 */
import lombok.Data;

@Data
public class HttpResult<T> {
    private Integer code;
    private String msg;
    private T data;

    private HttpResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> HttpResult<T> success(T data) {
        return new HttpResult<>(200, "success", data);
    }

    public static <T> HttpResult<T> success() {
        return new HttpResult<>(200, "success", null);
    }

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

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