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

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;

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

    @ApiModelProperty("모니터링유형(1:현시,2,시나리오,3,영상)")  // 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("VMS 제어기 번호")  // N NUMBER(10)
    @JsonProperty("vms_ctlr_nmbr")
    private Long vmsCtlrNmbr;

    // Code Description Field
    @ApiModelProperty("VMS 제어기 ID")  // Y VARCHAR(30)
    @JsonProperty("vms_ctlr_id")
    private String vmsCtlrId;

    @ApiModelProperty("VMS 명")  // Y VARCHAR(40)
    @JsonProperty("vms_nm")
    private String vmsNm;

    @ApiModelProperty("스트리밍 세션 명")  // Y VARCHAR(200)
    @JsonProperty("strm_sesn_nm")
    private String strmSesnNm;
    public void setType(Integer monitoringType) {
        this.monitoringType = monitoringType;
    }

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

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

    @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("TbVmsMonitoringUpdReq(VMS 모니터링 화면 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbVmsMonitoringUpdReq {

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

//        @ApiModelProperty("모니터링순서, Nullable = N, NUMBER(3)")  // N NUMBER(3)
//        @JsonProperty("monitoring_seq")
//        @PositiveOrZero
//        private Integer monitoringSeq;
//
//        @ApiModelProperty("VMS 제어기 번호, Nullable = N, NUMBER(10)")  // N NUMBER(10)
//        @JsonProperty("vms_ctlr_nmbr")
//        @PositiveOrZero
//        private Long vmsCtlrNmbr;

        @Builder
        public TbVmsMonitoringUpdReq(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;
        }

    }

}
