package com.its.op.dto.its.rse;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.rse.TbRseCtlrSttsHs;
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;

/**
 * RSE 상태 이력 DTO Class
 */
@Data
@Builder
@ApiModel("TbRseCtlrSttsHsDto(RSE 상태 이력)")
public class TbRseCtlrSttsHsDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("생성 일시")  // N VARCHAR2(14)
    @JsonProperty("crtn_dt")
    private String crtnDt;

    @ApiModelProperty("RSE 제어기 번호")  // N NUMBER(10)
    @JsonProperty("rse_ctlr_nmbr")
    private Long rseCtlrNmbr;

    @ApiModelProperty("통신 상태")  // Y VARCHAR2(7)
    @JsonProperty("cmnc_stts_cd")
    private String cmncSttsCd;

    @ApiModelProperty("제어 장치 상태")  // Y VARCHAR2(7)
    @JsonProperty("cntl_devc_stts")
    private String cntlDevcStts;

    @ApiModelProperty("안테나 1 상태")  // Y VARCHAR2(7)
    @JsonProperty("atn_1_stts")
    private String atn1Stts;

    @ApiModelProperty("안테나 2 상태")  // Y VARCHAR2(7)
    @JsonProperty("atn_2_stts")
    private String atn2Stts;

    @ApiModelProperty("안테나 3 상태")  // Y VARCHAR2(7)
    @JsonProperty("atn_3_stts")
    private String atn3Stts;

    @ApiModelProperty("안테나 4 상태")  // Y VARCHAR2(7)
    @JsonProperty("atn_4_stts")
    private String atn4Stts;

    @ApiModelProperty("안테나 1 동작")  // Y VARCHAR2(7)
    @JsonProperty("atn_1_mtns")
    private String atn1Mtns;

    @ApiModelProperty("안테나 2 동작")  // Y VARCHAR2(7)
    @JsonProperty("atn_2_mtns")
    private String atn2Mtns;

    @ApiModelProperty("안테나 3 동작")  // Y VARCHAR2(7)
    @JsonProperty("atn_3_mtns")
    private String atn3Mtns;

    @ApiModelProperty("안테나 4 동작")  // Y VARCHAR2(7)
    @JsonProperty("atn_4_mtns")
    private String atn4Mtns;

    // Code Description Field
    @ApiModelProperty("통신 상태 설명")
    @JsonProperty("cmnc_stts_desc")    // CMNC_STTS_CD
    private String cmncSttsDesc;

    @ApiModel("TbRseCtlrSttsHsUpdReq(RSE 상태 이력 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbRseCtlrSttsHsUpdReq {

        @ApiModelProperty("생성 일시, Nullable = N, VARCHAR2(14)")  // N VARCHAR2(14)
        @JsonProperty("crtn_dt")
        @Size(min=1, max=14)
        private String crtnDt;

        @ApiModelProperty("RSE 제어기 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("rse_ctlr_nmbr")
        @PositiveOrZero
        private Long rseCtlrNmbr;

        @ApiModelProperty("통신 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("cmnc_stts_cd")
        @Size(min=1, max=7)
        private String cmncSttsCd;

        @ApiModelProperty("제어 장치 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("cntl_devc_stts")
        @Size(min=1, max=7)
        private String cntlDevcStts;

        @ApiModelProperty("안테나 1 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_1_stts")
        @Size(min=1, max=7)
        private String atn1Stts;

        @ApiModelProperty("안테나 2 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_2_stts")
        @Size(min=1, max=7)
        private String atn2Stts;

        @ApiModelProperty("안테나 3 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_3_stts")
        @Size(min=1, max=7)
        private String atn3Stts;

        @ApiModelProperty("안테나 4 상태, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_4_stts")
        @Size(min=1, max=7)
        private String atn4Stts;

        @ApiModelProperty("안테나 1 동작, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_1_mtns")
        @Size(min=1, max=7)
        private String atn1Mtns;

        @ApiModelProperty("안테나 2 동작, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_2_mtns")
        @Size(min=1, max=7)
        private String atn2Mtns;

        @ApiModelProperty("안테나 3 동작, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_3_mtns")
        @Size(min=1, max=7)
        private String atn3Mtns;

        @ApiModelProperty("안테나 4 동작, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("atn_4_mtns")
        @Size(min=1, max=7)
        private String atn4Mtns;

        @Builder
        public TbRseCtlrSttsHsUpdReq(String crtn_dt, Long rse_ctlr_nmbr, String cmnc_stts_cd, String cntl_devc_stts, String atn_1_stts, String atn_2_stts, String atn_3_stts, String atn_4_stts, String atn_1_mtns, String atn_2_mtns, String atn_3_mtns, String atn_4_mtns) {
            this.crtnDt = crtn_dt;
            this.rseCtlrNmbr = rse_ctlr_nmbr;
            this.cmncSttsCd = cmnc_stts_cd;
            this.cntlDevcStts = cntl_devc_stts;
            this.atn1Stts = atn_1_stts;
            this.atn2Stts = atn_2_stts;
            this.atn3Stts = atn_3_stts;
            this.atn4Stts = atn_4_stts;
            this.atn1Mtns = atn_1_mtns;
            this.atn2Mtns = atn_2_mtns;
            this.atn3Mtns = atn_3_mtns;
            this.atn4Mtns = atn_4_mtns;
        }

        public TbRseCtlrSttsHs toEntity() {
            return TbRseCtlrSttsHs.builder()
                    .crtnDt(this.crtnDt)
                    .rseCtlrNmbr(this.rseCtlrNmbr)
                    .cmncSttsCd(this.cmncSttsCd)
                    .cntlDevcStts(this.cntlDevcStts)
                    .atn1Stts(this.atn1Stts)
                    .atn2Stts(this.atn2Stts)
                    .atn3Stts(this.atn3Stts)
                    .atn4Stts(this.atn4Stts)
                    .atn1Mtns(this.atn1Mtns)
                    .atn2Mtns(this.atn2Mtns)
                    .atn3Mtns(this.atn3Mtns)
                    .atn4Mtns(this.atn4Mtns)
                    .build();
        }

    }

}
