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

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.dto.its.common.MonitoringInfoDto;
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;
import java.util.List;

/**
 * 웹카메라 모니터링 화면 DTO Class
 */
@Data
@Builder
@ApiModel("TbCctvMonitoringDto(웹카메라 모니터링 화면)")
public class TbCctvMonitoringDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("모니터링유형(1:예비,2,예비,3,영상,4:예비)")  // N NUMBER(3)
    @JsonProperty("monitoring_type")
    private Integer monitoringType;

    @ApiModelProperty("모니터링명칭")  // N VARCHAR(40)
    @JsonProperty("monitoring_nm")
    private String monitoringNm;

    @ApiModelProperty("모니터링순서")  // N NUMBER(3)
    @JsonProperty("monitoring_seq")
    private Integer monitoringSeq;

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

    //@ApiModelProperty("화면에 보여지는 방식(0:기본,1:화면맞춤))")  // Y NUMBER(1)
    //@JsonProperty("view_mode")
    @JsonIgnore
    private Integer viewMode;

    // Code Description Field
    @ApiModelProperty("CCTV 제어기 ID")  // Y VARCHAR(30)
    @JsonProperty("cctv_ctlr_id")
    private String cctvCtlrId;

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

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

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

    @ApiModelProperty("WEB RTC 서버 IP")
    @JsonProperty("web_rtc_svr_ip")
    private String webRtcSvrIp;

    @ApiModelProperty("WEB RTC 포트")
    @JsonProperty("web_rtc_svr_port")
    private Integer webRtcSvrPort;

    @ApiModelProperty("WEB RTC ID")
    @JsonProperty("web_rtc_id")
    private String webRtcId;

    @ApiModel("TbCctvMonitoringUpdReq(웹카메라 모니터링 화면 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbCctvMonitoringUpdReq {

        @ApiModelProperty("모니터링유형(1:예비,2,예비,3,영상,4:예비), Nullable = N, NUMBER(3)")  // N NUMBER(3)
        @JsonProperty("monitoring_type")
        @PositiveOrZero
        private Integer monitoringType;

        @ApiModelProperty("모니터링명칭-원천, Nullable = N, VARCHAR(40)")  // N VARCHAR(40)
        @JsonProperty("org_monitoring_nm")
        @Size(min=1, max=40)
        private String orgMonitoringNm;

        @ApiModelProperty("모니터링명칭, Nullable = N, VARCHAR(40)")  // N VARCHAR(40)
        @JsonProperty("monitoring_nm")
        @Size(min=1, max=40)
        private String monitoringNm;

        private List<MonitoringInfoDto> infos;

        @Builder
        public TbCctvMonitoringUpdReq(Integer monitoring_type, String org_monitoring_nm, String monitoring_nm, List<MonitoringInfoDto> infos) {
            this.monitoringType = monitoring_type;
            this.orgMonitoringNm = org_monitoring_nm;
            this.monitoringNm = monitoring_nm;

            // FOR KISA Secure Coding pass
            //this.infos = infos;
            List<MonitoringInfoDto> temp = infos;
            this.infos = temp;
        }

    }

}
