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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.link.TbLinkParaStup;
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;
import java.util.List;

/**
 * 링크 파라미터 설정 DTO Class
 */
@Data
@Builder
@ApiModel("TbLinkParaStupDto(링크 파라미터 설정)")
public class TbLinkParaStupDto implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty("필터링 방법 코드")  // Y VARCHAR2(7)
    @JsonProperty("fltr_mthd_cd")
    private String fltrMthdCd;

    @ApiModelProperty("퓨전 방법 코드")  // Y VARCHAR2(7)
    @JsonProperty("fusn_mthd_cd")
    private String fusnMthdCd;

    @ApiModelProperty("보정 방법 코드")  // Y VARCHAR2(7)
    @JsonProperty("adjs_mthd_cd")
    private String adjsMthdCd;

    @ApiModelProperty("평활화 방법 코드")  // Y VARCHAR2(7)
    @JsonProperty("smth_mthd_cd")
    private String smthMthdCd;

    @ApiModelProperty("파라미터명")  // Y VARCHAR2(40)
    @JsonProperty("para_nm")
    private String paraNm;

    // TB_LINK_PARA_DETL
    @ApiModelProperty("가공 파라미터 상세")
    @JsonProperty("detl")
    private TbLinkParaDetlDto detl;

    // TB_LINK_PARA_CLCT_SYST
    @ApiModelProperty("가공 파라미터 수집 시스템")
    @JsonProperty("clcts")
    private List<TbLinkParaClctSystDto> clcts;

    // Code Description Field
    @ApiModelProperty("필터링 방법 코드 설명")
    @JsonProperty("fltr_mthd_desc")    // FLTR_MTHD_CD
    private String fltrMthdDesc;

    @ApiModelProperty("퓨전 방법 코드 설명")
    @JsonProperty("fusn_mthd_desc")    // FUSN_MTHD_CD
    private String fusnMthdDesc;

    @ApiModelProperty("보정 방법 코드 설명")
    @JsonProperty("adjs_mthd_desc")    // ADJS_MTHD_CD
    private String adjsMthdDesc;

    @ApiModelProperty("평활화 방법 코드 설명")
    @JsonProperty("smth_mthd_desc")    // SMTH_MTHD_CD
    private String smthMthdDesc;


    @ApiModel("TbLinkParaStupUpdReq(링크 파라미터 설정 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbLinkParaStupUpdReq {

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

        @ApiModelProperty("필터링 방법 코드, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("fltr_mthd_cd")
        @Size(min=1, max=7)
        private String fltrMthdCd;

        @ApiModelProperty("퓨전 방법 코드, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("fusn_mthd_cd")
        @Size(min=1, max=7)
        private String fusnMthdCd;

        @ApiModelProperty("보정 방법 코드, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("adjs_mthd_cd")
        @Size(min=1, max=7)
        private String adjsMthdCd;

        @ApiModelProperty("평활화 방법 코드, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("smth_mthd_cd")
        @Size(min=1, max=7)
        private String smthMthdCd;

        @ApiModelProperty("파라미터명, Nullable = Y, VARCHAR2(40)")  // Y VARCHAR2(40)
        @JsonProperty("para_nm")
        @Size(min=1, max=40)
        private String paraNm;

        @Builder
        public TbLinkParaStupUpdReq(Long para_id, String fltr_mthd_cd, String fusn_mthd_cd, String adjs_mthd_cd, String smth_mthd_cd, String para_nm) {
            this.paraId = para_id;
            this.fltrMthdCd = fltr_mthd_cd;
            this.fusnMthdCd = fusn_mthd_cd;
            this.adjsMthdCd = adjs_mthd_cd;
            this.smthMthdCd = smth_mthd_cd;
            this.paraNm = para_nm;
        }

        public TbLinkParaStup toEntity() {
            return TbLinkParaStup.builder()
                    .paraId(this.paraId)
                    .fltrMthdCd(this.fltrMthdCd)
                    .fusnMthdCd(this.fusnMthdCd)
                    .adjsMthdCd(this.adjsMthdCd)
                    .smthMthdCd(this.smthMthdCd)
                    .paraNm(this.paraNm)
                    .build();
        }

    }
    @ApiModel("TbLinkParaStupUpdReq(링크 파라미터 설정 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbLinkParaStupModReq {

        @ApiModelProperty("파라미터기본정보")  // N NUMBER(10)
        @JsonProperty("para")
        @Positive
        private TbLinkParaStupDto.TbLinkParaStupUpdReq para;

        @ApiModelProperty("파라미터설정정보")  // Y VARCHAR2(7)
        @JsonProperty("detl")
        private TbLinkParaDetlDto.TbLinkParaDetlUpdReq detl;

        @ApiModelProperty("파라미터수집정보")  // Y VARCHAR2(7)
        @JsonProperty("clcts")
        private List<TbLinkParaClctSystDto.TbLinkParaClctSystUpdReq> clcts;

        @Builder
        public TbLinkParaStupModReq(TbLinkParaStupDto.TbLinkParaStupUpdReq para, TbLinkParaDetlDto.TbLinkParaDetlUpdReq detl, List<TbLinkParaClctSystDto.TbLinkParaClctSystUpdReq> clcts) {
            this.para = para;
            this.detl = detl;
            this.clcts = clcts;
        }

    }

}
