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

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("TbWcamMonitoringDto(웹카메라 모니터링 화면)")
public class TbWcamMonitoringDto implements Serializable {
    private static final long serialVersionUID = 1L;

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

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

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

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

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


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

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

    @ApiModelProperty("WEB RTC 서버 아이피")  // Y VARCHAR2(20)
    @JsonProperty("web_rtc_svr_id")
    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
    @ApiModel("TbWcamMonitoringUpdReq(웹카메라 모니터링 화면 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbWcamMonitoringUpdReq {

        @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 TbWcamMonitoringUpdReq(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;
        }

    }

}
