package com.its.op.dto.its.cctv;

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

/**
 * CCTV 제어기 DTO Class
 */
@Data
@Builder
@ApiModel("TbCctvCtlrDto(CCTV 제어기)")
public class TbCctvCtlrDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("CCTV 관리 번호")  // N NUMBER(10)
    @JsonProperty("cctv_ctlr_nmbr")
    private Long cctvCtlrNmbr;

    @ApiModelProperty("CCTV 제어기 ID")  // Y VARCHAR2(10)
    @JsonProperty("cctv_ctlr_id")
    private String cctvCtlrId;

    @ApiModelProperty("CCTV 명칭")  // Y VARCHAR2(40)
    @JsonProperty("cctv_nm")
    private String cctvNm;

    @ApiModelProperty("설치 위치 명")  // Y VARCHAR2(40)
    @JsonProperty("istl_lctn_nm")
    private String istlLctnNm;

    @ApiModelProperty("설치 위치 주소")  // Y VARCHAR2(200)
    @JsonProperty("istl_lctn_addr")
    private String istlLctnAddr;

    @ApiModelProperty("CCTV 제어기 아이피")  // Y VARCHAR2(20)
    @JsonProperty("cctv_ctlr_ip")
    private String cctvCtlrIp;

    @ApiModelProperty("CCTV 제어기 포트")  // Y NUMBER(5)
    @JsonProperty("cctv_ctlr_port")
    private Integer cctvCtlrPort;

    @ApiModelProperty("CCTV 제어기 지역번호")  // Y NUMBER(5)
    @JsonProperty("cctv_ctlr_local_no")
    private Integer cctvCtlrLocalNo;

    @ApiModelProperty("CCTV 유형 코드('CCTVT')")  // Y VARCHAR2(7)
    @JsonProperty("cctv_type_cd")
    private String cctvTypeCd;

    @ApiModelProperty("CCTV 자막기 아이피")  // Y VARCHAR2(20)
    @JsonProperty("cctv_capt_ip")
    private String cctvCaptIp;

    @ApiModelProperty("CCTV 자막기 포트")  // Y NUMBER(5)
    @JsonProperty("cctv_capt_port")
    private Integer cctvCaptPort;

    @ApiModelProperty("스트리밍 서버 아이피--->분배서버ip")  // Y VARCHAR2(20)
    @JsonProperty("strm_svr_ip")
    private String strmSvrIp;

    @ApiModelProperty("스트리밍 서버 포트--->분배서버port")  // Y NUMBER(5)
    @JsonProperty("strm_svr_port")
    private Integer strmSvrPort;

    @ApiModelProperty("스트리밍 세션 명")  // Y VARCHAR2(200)
    @JsonProperty("strm_sesn_nm")
    private String strmSesnNm;

    @ApiModelProperty("X 좌표")  // Y NUMBER(11,8)
    @JsonProperty("x_crdn")
    private Double xCrdn;

    @ApiModelProperty("Y 좌표")  // Y NUMBER(10,8)
    @JsonProperty("y_crdn")
    private Double yCrdn;

    @ApiModelProperty("스트리밍 RTSP 주소")  // Y VARCHAR2(200)
    @JsonProperty("strm_rtsp_addr")
    private String strmRtspAddr;

    @ApiModelProperty("스트리밍 HTTP 주소")  // Y VARCHAR2(200)
    @JsonProperty("strm_http_addr")
    private String strmHttpAddr;

    @ApiModelProperty("인터넷 HLS 주소")  // Y VARCHAR2(200)
    @JsonProperty("intr_http_addr")
    private String intrHttpAddr;

    @ApiModelProperty("WEB RTC 서버 아이피")  // Y VARCHAR2(20)
    @JsonProperty("web_rtc_svr_ip")
    private String webRtcSvrIp;

    @ApiModelProperty("WEB RTC 서버 포트")  // Y NUMBER(5)
    @JsonProperty("web_rtc_svr_port")
    private Integer webRtcSvrPort;

    @ApiModelProperty("WEB RTC ID")  // Y VARCHAR2(56)
    @JsonProperty("web_rtc_id")
    private String webRtcId;

    @ApiModelProperty("대체 영상 이미지 번호")  // Y NUMBER(5)
    @JsonProperty("altt_imag_nmbr")
    private Integer alttImagNmbr;

    @ApiModelProperty("CCTV 대체 표출 여부")  // Y CHAR(1)
    @JsonProperty("altt_imag_dspl_yn")
    private String alttImagDsplYn;

    @ApiModelProperty("운영자 제어 여부")  // Y CHAR(1)
    @JsonProperty("syop_cntl_yn")
    private String syopCntlYn;

    @ApiModelProperty("링크ID")  // Y NUMBER(10)
    @JsonProperty("link_id")
    private Long linkId;

    @ApiModelProperty("노드ID")  // Y NUMBER(10)
    @JsonProperty("node_id")
    private Long nodeId;

    @ApiModelProperty("공단 CCTV ID")  // Y VARCHAR2(10)
    @JsonProperty("cctv_id")
    private String cctvId;

    @ApiModelProperty("CCTV 지역 구분")  // Y VARCHAR2(7)
    @JsonProperty("cctv_area_dvsn")
    private String cctvAreaDvsn;

    @ApiModelProperty("사용 여부")  // Y CHAR(1)
    @JsonProperty("use_yn")
    private String useYn;

    @ApiModelProperty("팬 ON 온도")  // Y NUMBER(3)
    @JsonProperty("fan_on_tmpr")
    private Integer fanOnTmpr;

    @ApiModelProperty("팬 OFF 온도")  // Y NUMBER(3)
    @JsonProperty("fan_off_tmpr")
    private Integer fanOffTmpr;

    @ApiModelProperty("히터 ON 온도")  // Y NUMBER(3)
    @JsonProperty("hetr_on_tmpr")
    private Integer hetrOnTmpr;

    @ApiModelProperty("히터 OFF 온도")  // Y NUMBER(3)
    @JsonProperty("hetr_off_tmpr")
    private Integer hetrOffTmpr;

    @ApiModelProperty("삭제 여부")  // Y CHAR(1)
    @JsonProperty("del_yn")
    private String delYn;

    // Code Description Field
    @ApiModelProperty("CCTV 유형 코드('CCTVT') 설명")
    @JsonProperty("cctv_type_desc")    // CCTV_TYPE_CD
    private String cctvTypeDesc;

    @ApiModelProperty("CCTV 대체 표출 여부 설명")
    @JsonProperty("altt_imag_dspl_desc")    // ALTT_IMAG_DSPL_YN
    private String alttImagDsplDesc;

    @ApiModelProperty("운영자 제어 여부 설명")
    @JsonProperty("syop_cntl_desc")    // SYOP_CNTL_YN
    private String syopCntlDesc;

    @ApiModelProperty("사용 여부 설명")
    @JsonProperty("use_desc")    // USE_YN
    private String useDesc;

    @ApiModelProperty("삭제 여부 설명")
    @JsonProperty("del_desc")    // DEL_YN
    private String delDesc;

    @ApiModel("TbCctvCtlrUpdReq(CCTV 제어기 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbCctvCtlrUpdReq {

        @ApiModelProperty("CCTV 관리 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("cctv_ctlr_nmbr")
        @PositiveOrZero
        private Long cctvCtlrNmbr;

        @ApiModelProperty("CCTV 제어기 ID, Nullable = Y, VARCHAR2(10)")  // Y VARCHAR2(10)
        @JsonProperty("cctv_ctlr_id")
        @Size(min=1, max=10)
        private String cctvCtlrId;

        @ApiModelProperty("CCTV 명칭, Nullable = Y, VARCHAR2(40)")  // Y VARCHAR2(40)
        @JsonProperty("cctv_nm")
        @Size(min=1, max=40)
        private String cctvNm;

        @ApiModelProperty("설치 위치 명, Nullable = Y, VARCHAR2(40)")  // Y VARCHAR2(40)
        @JsonProperty("istl_lctn_nm")
        @Size(min=1, max=40)
        private String istlLctnNm;

        @ApiModelProperty("설치 위치 주소, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("istl_lctn_addr")
        @Size(min=1, max=200)
        private String istlLctnAddr;

        @ApiModelProperty("CCTV 제어기 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("cctv_ctlr_ip")
        @Size(min=1, max=20)
        private String cctvCtlrIp;

        @ApiModelProperty("CCTV 제어기 포트, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("cctv_ctlr_port")
        @PositiveOrZero
        private Integer cctvCtlrPort;

        @ApiModelProperty("CCTV 제어기 지역번호, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("cctv_ctlr_local_no")
        @PositiveOrZero
        private Integer cctvCtlrLocalNo;

        @ApiModelProperty("CCTV 유형 코드('CCTVT'), Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("cctv_type_cd")
        @Size(min=1, max=7)
        private String cctvTypeCd;

        @ApiModelProperty("CCTV 자막기 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("cctv_capt_ip")
        @Size(min=1, max=20)
        private String cctvCaptIp;

        @ApiModelProperty("CCTV 자막기 포트, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("cctv_capt_port")
        @PositiveOrZero
        private Integer cctvCaptPort;

        @ApiModelProperty("스트리밍 서버 아이피--->분배서버ip, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("strm_svr_ip")
        @Size(min=1, max=20)
        private String strmSvrIp;

        @ApiModelProperty("스트리밍 서버 포트--->분배서버port, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("strm_svr_port")
        @PositiveOrZero
        private Integer strmSvrPort;

        @ApiModelProperty("스트리밍 세션 명, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("strm_sesn_nm")
        @Size(min=1, max=200)
        private String strmSesnNm;

        @ApiModelProperty("X 좌표, , NUMBER(11,8)")  // Y NUMBER(11,8)
        @JsonProperty("x_crdn")
        private Double xCrdn;

        @ApiModelProperty("Y 좌표, , NUMBER(10,8)")  // Y NUMBER(10,8)
        @JsonProperty("y_crdn")
        private Double yCrdn;

        @ApiModelProperty("스트리밍 RTSP 주소, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("strm_rtsp_addr")
        @Size(min=1, max=200)
        private String strmRtspAddr;

        @ApiModelProperty("스트리밍 HTTP 주소, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("strm_http_addr")
        @Size(min=1, max=200)
        private String strmHttpAddr;

        @ApiModelProperty("인터넷 HLS 주소, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("intr_http_addr")
        @Size(min=1, max=200)
        private String intrHttpAddr;

        @ApiModelProperty("WEB RTC 서버 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("web_rtc_svr_ip")
        @Size(max=20)
        private String webRtcSvrIp;

        @ApiModelProperty("WEB RTC 서버 포트, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("web_rtc_svr_port")
        @PositiveOrZero
        private Integer webRtcSvrPort;

        @ApiModelProperty("WEB RTC ID, Nullable = Y, VARCHAR2(56)")  // Y VARCHAR2(56)
        @JsonProperty("web_rtc_id")
        @Size(max=56)
        private String webRtcId;

        @ApiModelProperty("CCTV 대체 영상 이미지 번호, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("altt_imag_nmbr")
        @PositiveOrZero
        private Integer alttImagNmbr;

        @ApiModelProperty("CCTV 대체 표출 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("altt_imag_dspl_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String alttImagDsplYn;

        @ApiModelProperty("운영자 제어 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("syop_cntl_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String syopCntlYn;

        @ApiModelProperty("링크ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("link_id")
        @PositiveOrZero
        private Long linkId;

        @ApiModelProperty("노드ID, Nullable = Y, NUMBER(10)")  // Y NUMBER(10)
        @JsonProperty("node_id")
        @PositiveOrZero
        private Long nodeId;

        @ApiModelProperty("공단 CCTV ID, Nullable = Y, VARCHAR2(10)")  // Y VARCHAR2(10)
        @JsonProperty("cctv_id")
        @Size(min=1, max=10)
        private String cctvId;

        @ApiModelProperty("CCTV 지역 구분, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("cctv_area_dvsn")
        @Size(min=1, max=7)
        private String cctvAreaDvsn;

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

        @ApiModelProperty("팬 ON 온도, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("fan_on_tmpr")
        @PositiveOrZero
        private Integer fanOnTmpr;

        @ApiModelProperty("팬 OFF 온도, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("fan_off_tmpr")
        @PositiveOrZero
        private Integer fanOffTmpr;

        @ApiModelProperty("히터 ON 온도, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("hetr_on_tmpr")
        @PositiveOrZero
        private Integer hetrOnTmpr;

        @ApiModelProperty("히터 OFF 온도, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("hetr_off_tmpr")
        @PositiveOrZero
        private Integer hetrOffTmpr;

        @ApiModelProperty("삭제 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("del_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String delYn;

        @Builder
        public TbCctvCtlrUpdReq(Long cctv_ctlr_nmbr, String cctv_ctlr_id, String cctv_nm, String istl_lctn_nm, String istl_lctn_addr, String cctv_ctlr_ip, Integer cctv_ctlr_port, Integer cctv_ctlr_local_no, String cctv_type_cd, String cctv_capt_ip, Integer cctv_capt_port, String strm_svr_ip, Integer strm_svr_port, String strm_sesn_nm, Double x_crdn, Double y_crdn, String strm_rtsp_addr, String strm_http_addr, String intr_http_addr,
                                String web_rtc_svr_ip, Integer web_rtc_svr_port, String web_rtc_id, Integer altt_imag_nmbr, String altt_imag_dspl_yn, String syop_cntl_yn, Long link_id, Long node_id, String cctv_id, String cctv_area_dvsn, String use_yn, Integer fan_on_tmpr, Integer fan_off_tmpr, Integer hetr_on_tmpr, Integer hetr_off_tmpr, String del_yn) {
            this.cctvCtlrNmbr = cctv_ctlr_nmbr;
            this.cctvCtlrId = cctv_ctlr_id;
            this.cctvNm = cctv_nm;
            this.istlLctnNm = istl_lctn_nm;
            this.istlLctnAddr = istl_lctn_addr;
            this.cctvCtlrIp = cctv_ctlr_ip;
            this.cctvCtlrPort = cctv_ctlr_port;
            this.cctvCtlrLocalNo = cctv_ctlr_local_no;
            this.cctvTypeCd = cctv_type_cd;
            this.cctvCaptIp = cctv_capt_ip;
            this.cctvCaptPort = cctv_capt_port;
            this.strmSvrIp = strm_svr_ip;
            this.strmSvrPort = strm_svr_port;
            this.strmSesnNm = strm_sesn_nm;
            this.xCrdn = x_crdn;
            this.yCrdn = y_crdn;
            this.strmRtspAddr = strm_rtsp_addr;
            this.strmHttpAddr = strm_http_addr;
            this.intrHttpAddr = intr_http_addr;
            this.webRtcSvrIp = web_rtc_svr_ip;
            this.webRtcSvrPort = web_rtc_svr_port;
            this.webRtcId = web_rtc_id;
            this.alttImagNmbr = altt_imag_nmbr;
            this.alttImagDsplYn = altt_imag_dspl_yn;
            this.syopCntlYn = syop_cntl_yn;
            this.linkId = link_id;
            this.nodeId = node_id;
            this.cctvId = cctv_id;
            this.cctvAreaDvsn = cctv_area_dvsn;
            this.useYn = use_yn;
            this.fanOnTmpr = fan_on_tmpr;
            this.fanOffTmpr = fan_off_tmpr;
            this.hetrOnTmpr = hetr_on_tmpr;
            this.hetrOffTmpr = hetr_off_tmpr;
            this.delYn = del_yn;
        }

        public TbCctvCtlr toEntity() {
            return TbCctvCtlr.builder()
                    .cctvCtlrNmbr(this.cctvCtlrNmbr)
                    .cctvCtlrId(this.cctvCtlrId)
                    .cctvNm(this.cctvNm)
                    .istlLctnNm(this.istlLctnNm)
                    .istlLctnAddr(this.istlLctnAddr)
                    .cctvCtlrIp(this.cctvCtlrIp)
                    .cctvCtlrPort(this.cctvCtlrPort)
                    .cctvCtlrLocalNo(this.cctvCtlrLocalNo)
                    .cctvTypeCd(this.cctvTypeCd)
                    .cctvCaptIp(this.cctvCaptIp)
                    .cctvCaptPort(this.cctvCaptPort)
                    .strmSvrIp(this.strmSvrIp)
                    .strmSvrPort(this.strmSvrPort)
                    .strmSesnNm(this.strmSesnNm)
                    .xCrdn(this.xCrdn)
                    .yCrdn(this.yCrdn)
                    .strmRtspAddr(this.strmRtspAddr)
                    .strmHttpAddr(this.strmHttpAddr)
                    .intrHttpAddr(this.intrHttpAddr)
                    .webRtcSvrIp(this.webRtcSvrIp)
                    .webRtcSvrPort(this.webRtcSvrPort)
                    .webRtcId(this.webRtcId)
                    .alttImagNmbr(this.alttImagNmbr)
                    .alttImagDsplYn(this.alttImagDsplYn)
                    .syopCntlYn(this.syopCntlYn)
                    .linkId(this.linkId)
                    .nodeId(this.nodeId)
                    .cctvId(this.cctvId)
                    .cctvAreaDvsn(this.cctvAreaDvsn)
                    .useYn(this.useYn)
                    .fanOnTmpr(this.fanOnTmpr)
                    .fanOffTmpr(this.fanOffTmpr)
                    .hetrOnTmpr(this.hetrOnTmpr)
                    .hetrOffTmpr(this.hetrOffTmpr)
                    .delYn(this.delYn)
                    .build();
        }

    }

}
