package com.its.op.dto.its.vms;

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

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

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

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

    @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본)")  // N VARCHAR2(5)
    @JsonProperty("vms_sch_type")
    private String vmsSchType;

    @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상,9:대기환경,10:주차정보)")  // N NUMBER(3)
    @JsonProperty("vms_sch_form_type")
    private Integer vmsSchFormType;

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

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

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

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

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

    @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("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("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;

    @ApiModelProperty("동영상인 경우 동영상 파일 심벌 아이디")  // Y NUMBER(4)
    @JsonProperty("symb_lib_nmbr")
    private Integer symbLibNmbr;

    @ApiModelProperty("스트리밍인경우 스트리밍 주소")  // Y VARCHAR2(60)
    @JsonProperty("strm_addr")
    private String strmAddr;

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

    @ApiModelProperty("일")  // Y VARCHAR2(24)
    @JsonProperty("sch_week1")
    private String schWeek1;

    @ApiModelProperty("월")  // Y VARCHAR2(24)
    @JsonProperty("sch_week2")
    private String schWeek2;

    @ApiModelProperty("화")  // Y VARCHAR2(24)
    @JsonProperty("sch_week3")
    private String schWeek3;

    @ApiModelProperty("수")  // Y VARCHAR2(24)
    @JsonProperty("sch_week4")
    private String schWeek4;

    @ApiModelProperty("목")  // Y VARCHAR2(24)
    @JsonProperty("sch_week5")
    private String schWeek5;

    @ApiModelProperty("금")  // Y VARCHAR2(24)
    @JsonProperty("sch_week6")
    private String schWeek6;

    @ApiModelProperty("토")  // Y VARCHAR2(24)
    @JsonProperty("sch_week7")
    private String schWeek7;

    @ApiModelProperty("정체폼 표출시 표출여부")  // Y CHAR(1)
    @JsonProperty("dspl_cngs_yn")
    private String dsplCngsYn;

    // Code Description Field
    @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상,9:대기환경,10:주차정보)")  // N NUMBER(3)
    @JsonProperty("vms_sch_form_type_desc")    // TRFC_SITU_TYPE_CD
    private String vmsSchFormTypeDesc;

    @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;

    @ApiModelProperty("VMS FORM 유형 코드")  // N NUMBER(3)
    @JsonProperty("vms_form_type_cd")
    private Integer vmsFormTypeCd;

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

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

        @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본), Nullable = N, VARCHAR2(5)")  // N VARCHAR2(5)
        @JsonProperty("vms_sch_type")
        @Size(min=1, max=5)
        private String vmsSchType;

        @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상), Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("vms_sch_form_type")
        @PositiveOrZero
        private Integer vmsSchFormType;

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

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

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

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

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

        @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("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("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;

        @ApiModelProperty("동영상인 경우 동영상 파일 심벌 아이디, Nullable = Y, NUMBER(4)")  // Y NUMBER(4)
        @JsonProperty("symb_lib_nmbr")
        @PositiveOrZero
        private Integer symbLibNmbr;

        @ApiModelProperty("스트리밍인경우 스트리밍 주소, Nullable = Y, VARCHAR2(60)")  // Y VARCHAR2(60)
        @JsonProperty("strm_addr")
        @Size(min=1, max=60)
        private String strmAddr;

        @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("일, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week1")
        @Size(min=1, max=24)
        private String schWeek1;

        @ApiModelProperty("월, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week2")
        @Size(min=1, max=24)
        private String schWeek2;

        @ApiModelProperty("화, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week3")
        @Size(min=1, max=24)
        private String schWeek3;

        @ApiModelProperty("수, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week4")
        @Size(min=1, max=24)
        private String schWeek4;

        @ApiModelProperty("목, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week5")
        @Size(min=1, max=24)
        private String schWeek5;

        @ApiModelProperty("금, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week6")
        @Size(min=1, max=24)
        private String schWeek6;

        @ApiModelProperty("토, Nullable = Y, VARCHAR2(24)")  // Y VARCHAR2(24)
        @JsonProperty("sch_week7")
        @Size(min=1, max=24)
        private String schWeek7;

        @ApiModelProperty("정체폼 표출시 표출여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("dspl_cngs_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String dsplCngsYn;

        @Builder
        public TbVmsDsplSchUpdReq(Long vms_ctlr_nmbr, String vms_sch_type, Integer vms_sch_form_type, Integer phase, Integer vms_form_id, String dspl_strt_hh, String dspl_end_hh, Integer dspl_hh, Long frst_vms_ifsc_id, Long secd_vms_ifsc_id, Long thir_vms_ifsc_id, Long four_vms_ifsc_id, Long frst_img_ifsc_id, Long secd_img_ifsc_id, Long thir_img_ifsc_id, Long four_img_ifsc_id, Integer symb_lib_nmbr, String strm_addr, String use_yn, String sch_week1, String sch_week2, String sch_week3, String sch_week4, String sch_week5, String sch_week6, String sch_week7, String dspl_cngs_yn) {
            this.vmsCtlrNmbr = vms_ctlr_nmbr;
            this.vmsSchType = vms_sch_type;
            this.vmsSchFormType = vms_sch_form_type;
            this.phase = phase;
            this.vmsFormId = vms_form_id;
            this.dsplStrtHh = dspl_strt_hh;
            this.dsplEndHh = dspl_end_hh;
            this.dsplHh = dspl_hh;
            this.frstVmsIfscId = frst_vms_ifsc_id;
            this.secdVmsIfscId = secd_vms_ifsc_id;
            this.thirVmsIfscId = thir_vms_ifsc_id;
            this.fourVmsIfscId = four_vms_ifsc_id;
            this.frstImgIfscId = frst_img_ifsc_id;
            this.secdImgIfscId = secd_img_ifsc_id;
            this.thirImgIfscId = thir_img_ifsc_id;
            this.fourImgIfscId = four_img_ifsc_id;
            this.symbLibNmbr = symb_lib_nmbr;
            this.strmAddr = strm_addr;
            this.useYn = use_yn;
            this.schWeek1 = sch_week1;
            this.schWeek2 = sch_week2;
            this.schWeek3 = sch_week3;
            this.schWeek4 = sch_week4;
            this.schWeek5 = sch_week5;
            this.schWeek6 = sch_week6;
            this.schWeek7 = sch_week7;
            this.dsplCngsYn = dspl_cngs_yn;
        }

        public TbVmsDsplSch toEntity() {
            return TbVmsDsplSch.builder()
                    .vmsCtlrNmbr(this.vmsCtlrNmbr)
                    .vmsSchType(this.vmsSchType)
                    .vmsSchFormType(this.vmsSchFormType)
                    .phase(this.phase)
                    .vmsFormId(this.vmsFormId)
                    .dsplStrtHh(this.dsplStrtHh)
                    .dsplEndHh(this.dsplEndHh)
                    .dsplHh(this.dsplHh)
                    .frstVmsIfscId(this.frstVmsIfscId)
                    .secdVmsIfscId(this.secdVmsIfscId)
                    .thirVmsIfscId(this.thirVmsIfscId)
                    .fourVmsIfscId(this.fourVmsIfscId)
                    .frstImgIfscId(this.frstImgIfscId)
                    .secdImgIfscId(this.secdImgIfscId)
                    .thirImgIfscId(this.thirImgIfscId)
                    .fourImgIfscId(this.fourImgIfscId)
                    .symbLibNmbr(this.symbLibNmbr)
                    .strmAddr(this.strmAddr)
                    .useYn(this.useYn)
                    .schWeek1(this.schWeek1)
                    .schWeek2(this.schWeek2)
                    .schWeek3(this.schWeek3)
                    .schWeek4(this.schWeek4)
                    .schWeek5(this.schWeek5)
                    .schWeek6(this.schWeek6)
                    .schWeek7(this.schWeek7)
                    .dsplCngsYn(this.dsplCngsYn)
                    .build();
        }

    }


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

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

        @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본), Nullable = N, VARCHAR2(5)")  // N VARCHAR2(5)
        @JsonProperty("vms_sch_type")
        @Size(min=1, max=5)
        private String vmsSchType;

        @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상,9:대기환경,10:주차정보)")  // N NUMBER(3)
        @JsonProperty("vms_sch_form_type")
        @PositiveOrZero
        private Integer vmsSchFormType;

        @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("표출 시간, 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("사용여부(Y:시용,N:사용안함), Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("use_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String useYn;

        @Builder
        public TbVmsDsplSchEditUpdReq(Long vms_ctlr_nmbr, String vms_sch_type, Integer vms_sch_form_type, Integer phase, Integer vms_form_id, Integer dspl_hh, String dspl_strt_hh, String dspl_end_hh, String use_yn) {
            this.vmsCtlrNmbr = vms_ctlr_nmbr;
            this.vmsSchType = vms_sch_type;
            this.vmsSchFormType = vms_sch_form_type;
            this.phase = phase;
            this.vmsFormId = vms_form_id;
            this.dsplHh = dspl_hh;
            this.dsplStrtHh = dspl_strt_hh;
            this.dsplEndHh = dspl_end_hh;
            this.useYn = use_yn;
        }

        public TbVmsDsplSch toEntity() {
            Long defId = 0L;
            String defSch = "111111111111111111111111";
            return TbVmsDsplSch.builder()
                    .vmsCtlrNmbr(this.vmsCtlrNmbr)
                    .vmsSchType(this.vmsSchType)
                    .vmsSchFormType(this.vmsSchFormType)
                    .phase(this.phase)
                    .vmsFormId(this.vmsFormId)
                    .dsplStrtHh(this.dsplStrtHh)
                    .dsplEndHh(this.dsplEndHh)
                    .dsplHh(this.dsplHh)
                    .useYn(this.useYn)
                    //.vmsFormPrrtCd(null)
                    .frstVmsIfscId(defId)
                    .secdVmsIfscId(defId)
                    .thirVmsIfscId(defId)
                    .fourVmsIfscId(defId)
                    .frstImgIfscId(defId)
                    .secdImgIfscId(defId)
                    .thirImgIfscId(defId)
                    .fourImgIfscId(defId)
                    .symbLibNmbr(null)
                    .strmAddr(null)
                    .schWeek1(defSch)
                    .schWeek2(defSch)
                    .schWeek3(defSch)
                    .schWeek4(defSch)
                    .schWeek5(defSch)
                    .schWeek6(defSch)
                    .schWeek7(defSch)
                    .dsplCngsYn("Y")
                    .build();
        }

    }

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

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

        @ApiModelProperty("VMS 스케줄 유형(A:자동,F:고정,B:기본), Nullable = N, VARCHAR2(5)")  // N VARCHAR2(5)
        @JsonProperty("vms_sch_type")
        @Size(min=1, max=5)
        private String vmsSchType;

        @ApiModelProperty("VMS 폼 스케쥴 유형(0:교통,1:돌발,2:공사행사,3:홍보,4:우회,5:정체,6:안전,7:동영상,8:스트리밍영상), Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("vms_sch_form_type")
        @PositiveOrZero
        private Integer vmsSchFormType;

        @ApiModelProperty("PHASE")
        @JsonProperty("phase")
        @PositiveOrZero
        private Integer phase;

        @ApiModelProperty("VMS FORM ID")
        @JsonProperty("vms_form_id")
        @Positive
        private Integer vmsFormId;

        @Builder
        public TbVmsDsplSchDelReq(Long vms_ctlr_nmbr, String vms_sch_type, Integer vms_sch_form_type, Integer phase, Integer vms_form_id) {
            this.vmsCtlrNmbr = vms_ctlr_nmbr;
            this.vmsSchType = vms_sch_type;
            this.vmsSchFormType = vms_sch_form_type;
            this.phase = phase;
            this.vmsFormId = vms_form_id;
        }
    }

}
