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

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

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

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

    @ApiModelProperty("갱신 일시")  // Y VARCHAR2(14)
    @JsonProperty("updt_dt")
    private String updtDt;

    @ApiModelProperty("통신 상태(네트워크) 코드('CMS')")  // Y VARCHAR2(7)
    @JsonProperty("cmnc_stts_cd")
    private String cmncSttsCd;

    // Code Description Field
    @ApiModelProperty("통신 상태(네트워크) 코드('CMS') 설명")
    @JsonProperty("cmnc_stts_desc")    // CMNC_STTS_CD
    private String cmncSttsDesc;

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

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

    @ApiModelProperty("상태정보 결측 여부")
    @JsonProperty("miss_stts_yn")
    private String missSttsYn;

    @ApiModelProperty("수집건수")
    @JsonProperty("coll_cnt")
    private Integer collCnt;

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

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

        @ApiModelProperty("갱신 일시, Nullable = Y, VARCHAR2(14)")  // Y VARCHAR2(14)
        @JsonProperty("updt_dt")
        @Size(min=1, max=14)
        private String updtDt;

        @ApiModelProperty("통신 상태(네트워크) 코드('CMS'), Nullable = Y, VARCHAR2(7)")  // Y VARCHAR2(7)
        @JsonProperty("cmnc_stts_cd")
        @Size(min=1, max=7)
        private String cmncSttsCd;

        @Builder
        public TbWcamCtlrSttsUpdReq(Long wcam_ctlr_nmbr, String updt_dt, String cmnc_stts_cd) {
            this.wcamCtlrNmbr = wcam_ctlr_nmbr;
            this.updtDt = updt_dt;
            this.cmncSttsCd = cmnc_stts_cd;
        }

        public TbWcamCtlrStts toEntity() {
            return TbWcamCtlrStts.builder()
                    .wcamCtlrNmbr(this.wcamCtlrNmbr)
                    .updtDt(this.updtDt)
                    .cmncSttsCd(this.cmncSttsCd)
                    .build();
        }

    }

}
