package com.its.op.dto.its.wcam;

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

/**
 * 웹 카메라 DTO Class
 */
@Data
@Builder
@ApiModel("TbWcamCtlrDto(웹 카메라)")
public class TbWcamCtlrDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("웹카메라 제어기번호")  // N NUMBER(10)
    @JsonProperty("wcam_ctlr_nmbr")
    private Long wcamCtlrNmbr;

    @ApiModelProperty("웹카메라 제어기 ID")  // Y VARCHAR2(30)
    @JsonProperty("wcam_ctlr_id")
    private String wcamCtlrId;

    @ApiModelProperty("웹카메라 명칭")  // Y VARCHAR2(40)
    @JsonProperty("wcam_nm")
    private String wcamNm;

    @ApiModelProperty("웹카메라 제어기 아이피")  // Y VARCHAR2(20)
    @JsonProperty("wcam_ctlr_ip")
    private String wcamCtlrIp;

    @ApiModelProperty("웹카메라제어기 포트")  // Y VARCHAR2(5)
    @JsonProperty("wcam_ctlr_port")
    private String wcamCtlrPort;

    @ApiModelProperty("웹카메라 제어기 지역번호")  // Y NUMBER(5)
    @JsonProperty("wcam_ctlr_local_no")
    private Integer wcamCtlrLocalNo;

    @ApiModelProperty("웹카메라 유형")  // Y VARCHAR2(7)
    @JsonProperty("wcam_type_cd")
    private String wcamTypeCd;

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

    @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("삭제 여부")  // Y CHAR(1)
    @JsonProperty("del_yn")
    private String delYn;

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

    @ApiModelProperty("스트리밍 서버 포트")  // Y VARCHAR2(5)
    @JsonProperty("strm_svr_port")
    private String strmSvrPort;

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

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

    @ApiModelProperty("스트리밍 RTMP 주소")  // Y VARCHAR2(200)
    @JsonProperty("strm_rtmp_addr")
    private String strmRtmpAddr;

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

    @ApiModelProperty("스트리밍 저장 주소")  // Y VARCHAR2(200)
    @JsonProperty("strm_stor_addr")
    private String strmStorAddr;

    @ApiModelProperty("웹카메라 제어 포트")  // Y NUMBER(5)
    @JsonProperty("cmra_port")
    private Integer cmraPort;

    @ApiModelProperty("웹카메라 제어 ID")  // Y VARCHAR2(20)
    @JsonProperty("cmra_id")
    private String cmraId;

    @ApiModelProperty("웹카메라 제어 PSWD")  // Y VARCHAR2(64)
    @JsonProperty("cmra_pswd")
    private String cmraPswd;

    @ApiModelProperty("웹카메라제어 CHANNEL")  // Y NUMBER(5)
    @JsonProperty("cmra_chnl")
    private Integer cmraChnl;

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

    @ApiModelProperty("웹카메라 모델")  // Y VARCHAR2(20)
    @JsonProperty("wcam_modl")
    private String wcamModl;

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

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

    @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("RTC 서버 아이피")  // Y VARCHAR2(20)
    @JsonProperty("rtc_svr_ip")
    private String rtcSvrIp;

    @ApiModelProperty("RTC 서버 포트")  // Y NUMBER(5)
    @JsonProperty("rtc_svr_port")
    private Integer rtcSvrPort;

    @ApiModelProperty("RTC ID")  // Y VARCHAR2(56)
    @JsonProperty("rtc_id")
    private String rtcId;

    // Code Description Field
    @ApiModelProperty("웹카메라 유형 설명")
    @JsonProperty("wcam_type_desc")    // WCAM_TYPE_CD
    private String wcamTypeDesc;

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

    @ApiModel("TbWcamCtlrUpdReq(웹 카메라 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbWcamCtlrUpdReq {

        @ApiModelProperty("웹카메라 제어기번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
        @JsonProperty("wcam_ctlr_nmbr")
        @PositiveOrZero
        private Long wcamCtlrNmbr;

        @ApiModelProperty("웹카메라 제어기 ID, Nullable = Y, VARCHAR2(30)")  // Y VARCHAR2(30)
        @JsonProperty("wcam_ctlr_id")
        @Size(min=1, max=30)
        private String wcamCtlrId;

        @ApiModelProperty("웹카메라 명칭, Nullable = Y, VARCHAR2(40)")  // Y VARCHAR2(40)
        @JsonProperty("wcam_nm")
        @Size(min=1, max=40)
        private String wcamNm;

        @ApiModelProperty("웹카메라 제어기 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("wcam_ctlr_ip")
        @Size(min=1, max=20)
        private String wcamCtlrIp;

        @ApiModelProperty("웹카메라제어기 포트, Nullable = Y, VARCHAR2(5)")  // Y VARCHAR2(5)
        @JsonProperty("wcam_ctlr_port")
        @Size(min=1, max=5)
        private String wcamCtlrPort;

        @ApiModelProperty("웹카메라 제어기 지역번호, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("wcam_ctlr_local_no")
        @PositiveOrZero
        private Integer wcamCtlrLocalNo;

        @ApiModelProperty("웹카메라 유형, Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("wcam_type_cd")
        @Size(min=1, max=7)
        private String wcamTypeCd;

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

        @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("삭제 여부, Nullable = Y, CHAR(1)")  // Y CHAR(1)
        @JsonProperty("del_yn")
        @Size(min=1, max=1)
        @Pattern(regexp = "[YN]")
        private String delYn;

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

        @ApiModelProperty("스트리밍 서버 포트, Nullable = Y, VARCHAR2(5)")  // Y VARCHAR2(5)
        @JsonProperty("strm_svr_port")
        @Size(min=1, max=5)
        private String strmSvrPort;

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

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

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

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

        @ApiModelProperty("스트리밍 저장 주소, Nullable = Y, VARCHAR2(200)")  // Y VARCHAR2(200)
        @JsonProperty("strm_stor_addr")
        @Size(min=1, max=200)
        private String strmStorAddr;

        @ApiModelProperty("웹카메라 제어 포트, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("cmra_port")
        @PositiveOrZero
        private Integer cmraPort;

        @ApiModelProperty("웹카메라 제어 ID, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("cmra_id")
        @Size(min=1, max=20)
        private String cmraId;

        @ApiModelProperty("웹카메라 제어 PSWD, Nullable = Y, VARCHAR2(64)")  // Y VARCHAR2(64)
        @JsonProperty("cmra_pswd")
        @Size(min=1, max=64)
        private String cmraPswd;

        @ApiModelProperty("웹카메라제어 CHANNEL, Nullable = Y, NUMBER(5)")  // Y NUMBER(5)
        @JsonProperty("cmra_chnl")
        @PositiveOrZero
        private Integer cmraChnl;

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

        @ApiModelProperty("웹카메라 모델, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("wcam_modl")
        @Size(min=1, max=20)
        private String wcamModl;

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

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

        @ApiModelProperty("WEB RTC 서버 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("web_rtc_svr_ip")
        @Size(min=1, 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(min=1, max=56)
        private String webRtcId;

        @ApiModelProperty("RTC 서버 아이피, Nullable = Y, VARCHAR2(20)")  // Y VARCHAR2(20)
        @JsonProperty("rtc_svr_ip")
        @Size(min=1, max=20)
        private String rtcSvrIp;

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

        @ApiModelProperty("RTC ID, Nullable = Y, VARCHAR2(56)")  // Y VARCHAR2(56)
        @JsonProperty("rtc_id")
        @Size(min=1, max=56)
        private String rtcId;

        @Builder
        public TbWcamCtlrUpdReq(Long wcam_ctlr_nmbr, String wcam_ctlr_id, String wcam_nm, String wcam_ctlr_ip, String wcam_ctlr_port, Integer wcam_ctlr_local_no, String wcam_type_cd, String istl_lctn_nm, Double x_crdn, Double y_crdn, String del_yn, String strm_svr_ip, String strm_svr_port, String strm_sesn_nm, String strm_rtsp_addr, String strm_rtmp_addr, String strm_http_addr, String strm_stor_addr, Integer cmra_port, String cmra_id, String cmra_pswd, Integer cmra_chnl, Long link_id, String wcam_modl, String istl_lctn_addr, String full_strm_sesn_nm, String web_rtc_svr_ip, Integer web_rtc_svr_port, String web_rtc_id, String rtc_svr_ip, Integer rtc_svr_port, String rtc_id) {
            this.wcamCtlrNmbr = wcam_ctlr_nmbr;
            this.wcamCtlrId = wcam_ctlr_id;
            this.wcamNm = wcam_nm;
            this.wcamCtlrIp = wcam_ctlr_ip;
            this.wcamCtlrPort = wcam_ctlr_port;
            this.wcamCtlrLocalNo = wcam_ctlr_local_no;
            this.wcamTypeCd = wcam_type_cd;
            this.istlLctnNm = istl_lctn_nm;
            this.xCrdn = x_crdn;
            this.yCrdn = y_crdn;
            this.delYn = del_yn;
            this.strmSvrIp = strm_svr_ip;
            this.strmSvrPort = strm_svr_port;
            this.strmSesnNm = strm_sesn_nm;
            this.strmRtspAddr = strm_rtsp_addr;
            this.strmRtmpAddr = strm_rtmp_addr;
            this.strmHttpAddr = strm_http_addr;
            this.strmStorAddr = strm_stor_addr;
            this.cmraPort = cmra_port;
            this.cmraId = cmra_id;
            this.cmraPswd = cmra_pswd;
            this.cmraChnl = cmra_chnl;
            this.linkId = link_id;
            this.wcamModl = wcam_modl;
            this.istlLctnAddr = istl_lctn_addr;
            this.fullStrmSesnNm = full_strm_sesn_nm;
            this.webRtcSvrIp = web_rtc_svr_ip;
            this.webRtcSvrPort = web_rtc_svr_port;
            this.webRtcId = web_rtc_id;
            this.rtcSvrIp = rtc_svr_ip;
            this.rtcSvrPort = rtc_svr_port;
            this.rtcId = rtc_id;
        }

        public TbWcamCtlr toEntity() {
            return TbWcamCtlr.builder()
                    .wcamCtlrNmbr(this.wcamCtlrNmbr)
                    .wcamCtlrId(this.wcamCtlrId)
                    .wcamNm(this.wcamNm)
                    .wcamCtlrIp(this.wcamCtlrIp)
                    .wcamCtlrPort(this.wcamCtlrPort)
                    .wcamCtlrLocalNo(this.wcamCtlrLocalNo)
                    .wcamTypeCd(this.wcamTypeCd)
                    .istlLctnNm(this.istlLctnNm)
                    .xCrdn(this.xCrdn)
                    .yCrdn(this.yCrdn)
                    .delYn(this.delYn)
                    .strmSvrIp(this.strmSvrIp)
                    .strmSvrPort(this.strmSvrPort)
                    .strmSesnNm(this.strmSesnNm)
                    .strmRtspAddr(this.strmRtspAddr)
                    .strmRtmpAddr(this.strmRtmpAddr)
                    .strmHttpAddr(this.strmHttpAddr)
                    .strmStorAddr(this.strmStorAddr)
                    .cmraPort(this.cmraPort)
                    .cmraId(this.cmraId)
                    .cmraPswd(this.cmraPswd)
                    .cmraChnl(this.cmraChnl)
                    .linkId(this.linkId)
                    .wcamModl(this.wcamModl)
                    .istlLctnAddr(this.istlLctnAddr)
                    .fullStrmSesnNm(this.fullStrmSesnNm)
                    .webRtcSvrIp(this.webRtcSvrIp)
                    .webRtcSvrPort(this.webRtcSvrPort)
                    .webRtcId(this.webRtcId)
                    .rtcSvrIp(this.rtcSvrIp)
                    .rtcSvrPort(this.rtcSvrPort)
                    .rtcId(this.rtcId)
                    .build();
        }

    }

}
