package com.wms_main.model.dto.response.mywms;


import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
public class MyWmsResponse<T> {

    @JsonProperty("code")
    private Integer code;

    @JsonProperty("message")
    private String message;

    @JsonProperty("data")
    private T data;


    public MyWmsResponse(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public MyWmsResponse(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

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

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

    public static <T> MyWmsResponse<T> error(String message, T data) {
        return new MyWmsResponse<>(999, message, data);
    }

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

}
