package cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model;

import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

@Getter
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Schema(name = "PayApiRespDTO")
public class PayApiRespDTO<T> {

    @Schema(title = "응답코드", example = " ")
    @JsonProperty("res_code")  
    @JsonAlias({"resCode", "code"})
    @SerializedName(value = "res_code", alternate = {"resCode", "code"})
    private String resCode;

    @Schema(title = "응답메시지", example = " ")
    @Setter
    private String message;

    @Schema(title = "응답데이터", example = " ")
    @Setter
    @JsonProperty("data")  
    @JsonAlias({"body"})
    @SerializedName(value = "data", alternate = {"body"})
    private T data;


    @Builder(builderClassName = "okBuilder", builderMethodName = "okBuilder")
    PayApiRespDTO(T data) {
        this.resCode = PayUseSysResCd.OK.getCode();
        this.message = PayUseSysResCd.OK.getCodeNm();
        this.data = data;
    }

    @Builder(builderClassName = "errBuilder", builderMethodName = "errBuilder")
    PayApiRespDTO(String resCode, String message) {
        this.resCode = resCode;
        this.message = message;
        this.data = null;
    }

    @Builder(builderClassName = "errDataBuilder", builderMethodName = "errDataBuilder")
    PayApiRespDTO(String resCode, String message, T data) {
        this.resCode = resCode;
        this.message = message;
        this.data = data;
    }

}
