package com.its.api.its.model.dto.link;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.api.its.model.entity.link.TbClctSystSttsHs;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

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

/**
 * 수집 시스템 상태 이력 DTO Class
 */
@Data
@Builder
@ApiModel("TbClctSystSttsHsDto(수집 시스템 상태 이력)")
public class TbClctSystSttsHsDto implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty("가공 일시")  // N VARCHAR(14)
    @JsonProperty("prcn_dt")
    private String prcnDt;

    @ApiModelProperty("수집 개수")  // Y NUMBER(7)
    @JsonProperty("clct_num")
    private Integer clctNum;

    @ApiModelProperty("필터링 개수")  // Y NUMBER(7)
    @JsonProperty("fltr_num")
    private Integer fltrNum;

    @ApiModelProperty("퓨전 개수")  // Y NUMBER(7)
    @JsonProperty("fusn_num")
    private Integer fusnNum;

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

    @ApiModel("TbClctSystSttsHsUpdReq(수집 시스템 상태 이력 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbClctSystSttsHsUpdReq {

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

        @ApiModelProperty("가공 일시, Nullable = N, VARCHAR(14)")  // N VARCHAR(14)
        @JsonProperty("prcn_dt")
        @Size(min=1, max=14)
        private String prcnDt;

        @ApiModelProperty("수집 개수, Nullable = Y, NUMBER(7)")  // Y NUMBER(7)
        @JsonProperty("clct_num")
        @PositiveOrZero
        private Integer clctNum;

        @ApiModelProperty("필터링 개수, Nullable = Y, NUMBER(7)")  // Y NUMBER(7)
        @JsonProperty("fltr_num")
        @PositiveOrZero
        private Integer fltrNum;

        @ApiModelProperty("퓨전 개수, Nullable = Y, NUMBER(7)")  // Y NUMBER(7)
        @JsonProperty("fusn_num")
        @PositiveOrZero
        private Integer fusnNum;

        @Builder
        public TbClctSystSttsHsUpdReq(String clct_syst_cd, String prcn_dt, Integer clct_num, Integer fltr_num, Integer fusn_num) {
            this.clctSystCd = clct_syst_cd;
            this.prcnDt = prcn_dt;
            this.clctNum = clct_num;
            this.fltrNum = fltr_num;
            this.fusnNum = fusn_num;
        }

        public TbClctSystSttsHs toEntity() {
            return TbClctSystSttsHs.builder()
                    .clctSystCd(this.clctSystCd)
                    .prcnDt(this.prcnDt)
                    .clctNum(this.clctNum)
                    .fltrNum(this.fltrNum)
                    .fusnNum(this.fusnNum)
                    .build();
        }

    }

}
