package com.its.op.dto.its.link;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.link.TbLinkParaClctSyst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.Positive;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 링크 파라미터 수집 시스템 DTO Class
 */
@Data
@Builder
@ApiModel("TbLinkParaClctSystDto(링크 파라미터 수집 시스템)")
public class TbLinkParaClctSystDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("파라미터ID")  // N NUMBER(10)
    @JsonProperty("para_id")
    private Long paraId;

    @ApiModelProperty("수집 시스템 코드")  // N VARCHAR2(7)
    @JsonProperty("clct_syst_cd")
    private String clctSystCd;

    @ApiModelProperty("퓨전 우선순위")  // Y NUMBER(2)
    @JsonProperty("fusn_prrt")
    private Integer fusnPrrt;

    @ApiModelProperty("퓨전 가중치")  // Y NUMBER(5,2)
    @JsonProperty("fusn_wght")
    private Double fusnWght;

    // Code Description Field
    @ApiModelProperty("수집 시스템 코드 설명")
    @JsonProperty("clct_syst_desc")    // CLCT_SYST_CD
    private String clctSystDesc;

    @ApiModel("TbLinkParaClctSystUpdReq(링크 파라미터 수집 시스템 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbLinkParaClctSystUpdReq {

        @ApiModelProperty("파라미터ID, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("para_id")
        @Positive
        private Long paraId;

        @ApiModelProperty("수집 시스템 코드, Nullable = N, VARCHAR2(7)")  // N VARCHAR2(7)
        @JsonProperty("clct_syst_cd")
        @Size(min=1, max=7)
        private String clctSystCd;

        @ApiModelProperty("퓨전 우선순위, Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("fusn_prrt")
        @Positive
        private Integer fusnPrrt;

        @ApiModelProperty("퓨전 가중치, , NUMBER(5,2)")  // Y NUMBER(5,2)
        @JsonProperty("fusn_wght")
        private Double fusnWght;

        @Builder
        public TbLinkParaClctSystUpdReq(Long para_id, String clct_syst_cd, Integer fusn_prrt, Double fusn_wght) {
            this.paraId = para_id;
            this.clctSystCd = clct_syst_cd;
            this.fusnPrrt = fusn_prrt;
            this.fusnWght = fusn_wght;
        }

        public TbLinkParaClctSyst toEntity() {
            return TbLinkParaClctSyst.builder()
                    .paraId(this.paraId)
                    .clctSystCd(this.clctSystCd)
                    .fusnPrrt(this.fusnPrrt)
                    .fusnWght(this.fusnWght)
                    .build();
        }

    }

}
