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

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

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

/**
 * VMS 교통 정보 표출 일정 DTO Class
 */
@Data
@Builder
@ApiModel("TbVmsTrfcInfrDsplSchDto(VMS 교통 정보 표출 일정)")
public class TbVmsMsgDsplSchDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("VMS 제어기 번호")  // N NUMBER(10)
    @JsonProperty("vms_ctlr_nmbr")
    private Long vmsCtlrNmbr;

    @ApiModelProperty("스케줄 유형 코드(0:교통정보,1:돌발,2:공사/행사문안,3:홍보문안,4:우회도로,5:고정스케줄, 6:기본스케줄)")  // N VARCHAR(7)
    @JsonProperty("trfc_situ_type_cd")
    private String trfcSituTypeCd;

    @ApiModelProperty("PHASE")  // N NUMBER(2)
    @JsonProperty("phase")
    private Integer phase;

    @ApiModelProperty("VMS FORM ID")  // Y NUMBER(5)
    @JsonProperty("vms_form_id")
    private Integer vmsFormId;

    @ApiModelProperty("1단 VMS 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("frst_vms_ifsc_id")
    private Long frstVmsIfscId;

    @ApiModelProperty("2단 VMS 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("secd_vms_ifsc_id")
    private Long secdVmsIfscId;

    @ApiModelProperty("VMS FORM 우선순위 코드")  // Y VARCHAR(3)
    @JsonProperty("vms_form_prrt_cd")
    private String vmsFormPrrtCd;

    @ApiModelProperty("표출 시간")  // Y NUMBER(3)
    @JsonProperty("dspl_hh")
    private Integer dsplHh;

    @ApiModelProperty("표출 시작 시간")  // Y VARCHAR(14)
    @JsonProperty("dspl_strt_hh")
    private String dsplStrtHh;

    @ApiModelProperty("표출 종료 시간")  // Y VARCHAR(14)
    @JsonProperty("dspl_end_hh")
    private String dsplEndHh;

    @ApiModelProperty("3단 VMS 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("thir_vms_ifsc_id")
    private Long thirVmsIfscId;

    @ApiModelProperty("4단 VMS 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("four_vms_ifsc_id")
    private Long fourVmsIfscId;

    @ApiModelProperty("사용여부(Y:시용,N:사용안함)")  // Y CHAR(1)
    @JsonProperty("use_yn")
    private String useYn;

    @ApiModelProperty("1단 이미지 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("frst_img_ifsc_id")
    private Long frstImgIfscId;

    @ApiModelProperty("2단 이미지 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("secd_img_ifsc_id")
    private Long secdImgIfscId;

    @ApiModelProperty("3단 이미지 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("thir_img_ifsc_id")
    private Long thirImgIfscId;

    @ApiModelProperty("4단 이미지 정보제공구간 ID")  // Y NUMBER(10)
    @JsonProperty("four_img_ifsc_id")
    private Long fourImgIfscId;

    // Code Description Field
    @ApiModelProperty("스케줄 유형 코드(0:교통정보,1:돌발,2:공사/행사문안,3:홍보문안,4:우회도로,5:고정스케줄, 6:기본스케줄) 설명")
    @JsonProperty("trfc_situ_type_desc")    // TRFC_SITU_TYPE_CD
    private String trfcSituTypeDesc;

    @ApiModelProperty("VMS FORM 우선순위 코드 설명")
    @JsonProperty("vms_form_prrt_desc")    // VMS_FORM_PRRT_CD
    private String vmsFormPrrtDesc;

    @ApiModelProperty("사용여부(Y:시용,N:사용안함) 설명")
    @JsonProperty("use_desc")    // USE_YN
    private String useDesc;

    @ApiModelProperty("VMS FORM 이미지")  // Y BLOB
    @JsonProperty("vms_form_imag")
    private byte[] vmsFormImag;

    @ApiModelProperty("VMS FORM 이미지 형식(bmp, png)")
    @JsonProperty("imag_fmt")
    private String imagFmt;

    @ApiModel("TbVmsTrfcInfrDsplSchUpdReq(VMS 교통 정보 표출 일정 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbVmsTrfcInfrDsplSchUpdReq {

        @ApiModelProperty("VMS 제어기 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("vms_ctlr_nmbr")
        @PositiveOrZero
        private Long vmsCtlrNmbr;

        @ApiModelProperty("스케줄 유형 코드(0:교통정보,1:돌발,2:공사/행사문안,3:홍보문안,4:우회도로,5:고정스케줄, 6:기본스케줄), Nullable = N, VARCHAR(7)")  // N VARCHAR(7)
        @JsonProperty("trfc_situ_type_cd")
        @Size(min=1, max=7)
        private String trfcSituTypeCd;

        @ApiModelProperty("PHASE, Nullable = N, NUMBER(2)")  // N NUMBER(2)
        @JsonProperty("phase")
        @PositiveOrZero
        private Integer phase;

        @ApiModelProperty("VMS FORM ID, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_form_id")
        @PositiveOrZero
        private Integer vmsFormId;

        @ApiModelProperty("1단 VMS 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("frst_vms_ifsc_id")
        @PositiveOrZero
        private Long frstVmsIfscId;

        @ApiModelProperty("2단 VMS 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("secd_vms_ifsc_id")
        @PositiveOrZero
        private Long secdVmsIfscId;

        @ApiModelProperty("VMS FORM 우선순위 코드, Nullable = Y, VARCHAR(3)")  // Y VARCHAR(3)
        @JsonProperty("vms_form_prrt_cd")
        @Size(min=1, max=3)
        private String vmsFormPrrtCd;

        @ApiModelProperty("표출 시간, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("dspl_hh")
        @PositiveOrZero
        private Integer dsplHh;

        @ApiModelProperty("표출 시작 시간, Nullable = Y, VARCHAR(14)")  // Y VARCHAR(14)
        @JsonProperty("dspl_strt_hh")
        @Size(min=1, max=14)
        private String dsplStrtHh;

        @ApiModelProperty("표출 종료 시간, Nullable = Y, VARCHAR(14)")  // Y VARCHAR(14)
        @JsonProperty("dspl_end_hh")
        @Size(min=1, max=14)
        private String dsplEndHh;

        @ApiModelProperty("3단 VMS 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("thir_vms_ifsc_id")
        @PositiveOrZero
        private Long thirVmsIfscId;

        @ApiModelProperty("4단 VMS 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("four_vms_ifsc_id")
        @PositiveOrZero
        private Long fourVmsIfscId;

        @ApiModelProperty("사용여부(Y:시용,N:사용안함), Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("use_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String useYn;

        @ApiModelProperty("1단 이미지 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("frst_img_ifsc_id")
        @PositiveOrZero
        private Long frstImgIfscId;

        @ApiModelProperty("2단 이미지 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("secd_img_ifsc_id")
        @PositiveOrZero
        private Long secdImgIfscId;

        @ApiModelProperty("3단 이미지 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("thir_img_ifsc_id")
        @PositiveOrZero
        private Long thirImgIfscId;

        @ApiModelProperty("4단 이미지 정보제공구간 ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("four_img_ifsc_id")
        @PositiveOrZero
        private Long fourImgIfscId;

        @Builder
        public TbVmsTrfcInfrDsplSchUpdReq(Long vms_ctlr_nmbr, String trfc_situ_type_cd, Integer phase, Integer vms_form_id, Long frst_vms_ifsc_id, Long secd_vms_ifsc_id, String vms_form_prrt_cd, Integer dspl_hh, String dspl_strt_hh, String dspl_end_hh, Long thir_vms_ifsc_id, Long four_vms_ifsc_id, String use_yn, Long frst_img_ifsc_id, Long secd_img_ifsc_id, Long thir_img_ifsc_id, Long four_img_ifsc_id) {
            this.vmsCtlrNmbr = vms_ctlr_nmbr;
            this.trfcSituTypeCd = trfc_situ_type_cd;
            this.phase = phase;
            this.vmsFormId = vms_form_id;
            this.frstVmsIfscId = frst_vms_ifsc_id;
            this.secdVmsIfscId = secd_vms_ifsc_id;
            this.vmsFormPrrtCd = vms_form_prrt_cd;
            this.dsplHh = dspl_hh;
            this.dsplStrtHh = dspl_strt_hh;
            this.dsplEndHh = dspl_end_hh;
            this.thirVmsIfscId = thir_vms_ifsc_id;
            this.fourVmsIfscId = four_vms_ifsc_id;
            this.useYn = use_yn;
            this.frstImgIfscId = frst_img_ifsc_id;
            this.secdImgIfscId = secd_img_ifsc_id;
            this.thirImgIfscId = thir_img_ifsc_id;
            this.fourImgIfscId = four_img_ifsc_id;
        }

        public TbVmsMsgDsplSch toEntity() {
            return TbVmsMsgDsplSch.builder()
                    .vmsCtlrNmbr(this.vmsCtlrNmbr)
                    .trfcSituTypeCd(this.trfcSituTypeCd)
                    .phase(this.phase)
                    .vmsFormId(this.vmsFormId)
                    .frstVmsIfscId(this.frstVmsIfscId)
                    .secdVmsIfscId(this.secdVmsIfscId)
                    .vmsFormPrrtCd(this.vmsFormPrrtCd)
                    .dsplHh(this.dsplHh)
                    .dsplStrtHh(this.dsplStrtHh)
                    .dsplEndHh(this.dsplEndHh)
                    .thirVmsIfscId(this.thirVmsIfscId)
                    .fourVmsIfscId(this.fourVmsIfscId)
                    .useYn(this.useYn)
                    .frstImgIfscId(this.frstImgIfscId)
                    .secdImgIfscId(this.secdImgIfscId)
                    .thirImgIfscId(this.thirImgIfscId)
                    .fourImgIfscId(this.fourImgIfscId)
                    .build();
        }

    }
    @ApiModel("TbVmsTrfcInfrDsplSchDelReq(VMS 교통 정보 표출 일정 정보삭제)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor(access = AccessLevel.PROTECTED)
    public static class TbVmsTrfcInfrDsplSchDelReq {

        @ApiModelProperty("VMS 제어기 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("vms_ctlr_nmbr")
        @PositiveOrZero
        private Long vmsCtlrNmbr;

        @ApiModelProperty("스케줄 유형 코드(0:교통정보,1:돌발,2:공사/행사문안,3:홍보문안,4:우회도로,5:고정스케줄, 6:기본스케줄), Nullable = N, VARCHAR(7)")
        // N VARCHAR(7)
        @JsonProperty("trfc_situ_type_cd")
        @Size(min = 1, max = 7)
        private String trfcSituTypeCd;

        @ApiModelProperty("PHASE, Nullable = N, NUMBER(2)")  // N NUMBER(2)
        @JsonProperty("phase")
        @PositiveOrZero
        private Integer phase;

        @ApiModelProperty("VMS FORM ID, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("vms_form_id")
        @PositiveOrZero
        private Integer vmsFormId;

        @Builder
        public TbVmsTrfcInfrDsplSchDelReq(Long vms_ctlr_nmbr, String trfc_situ_type_cd, Integer phase, Integer vms_form_id) {
            this.vmsCtlrNmbr = vms_ctlr_nmbr;
            this.trfcSituTypeCd = trfc_situ_type_cd;
            this.phase = phase;
            this.vmsFormId = vms_form_id;
        }
    }

}
