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

import com.fasterxml.jackson.annotation.JsonProperty;
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;

/**
 * CCTV 가변 문자 설정 DTO Class
 */
@Data
@Builder
@ApiModel("CctvVarCharControlDto(CCTV 가변 문자 설정 정보")
public class CctvVarCharControlDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModel("CctvVarCharControlSetReq(CCTV 가변 문자 설정)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvVarCharControlSetReq {

        @ApiModelProperty("Sector No. 0~6")
        @JsonProperty("sector_no")
        @PositiveOrZero
        private Integer sectorNo;

        @ApiModelProperty("Start Pan Value 0~1024")
        @JsonProperty("start_pan")
        @PositiveOrZero
        private Short startPan;

        @ApiModelProperty("End Pan Value 0~1024")
        @JsonProperty("end_pan")
        @PositiveOrZero
        private Short endPan;

        @ApiModelProperty("CH1 Character Size(Small: 0x02, Middle:0x03, Large:0x04)")
        @JsonProperty("ch1_char_size")
        @PositiveOrZero
        private Short ch1CharSize;

        @ApiModelProperty("CH1 Character X Position Value 0~1280")
        @JsonProperty("ch1_pos_x")
        @PositiveOrZero
        private Short ch1PosX;

        @ApiModelProperty("CH1 Character Y Position Value 0~720")
        @JsonProperty("ch1_pos_y")
        @PositiveOrZero
        private Short ch1PosY;

        @ApiModelProperty("CH2 Character Size(Small: 0x02, Middle:0x03, Large:0x04)")
        @JsonProperty("ch2_char_size")
        @PositiveOrZero
        private Short ch2CharSize;

        @ApiModelProperty("CH2 Character X Position Value 0~1280")
        @JsonProperty("ch2_pos_x")
        @PositiveOrZero
        private Short ch2PosX;

        @ApiModelProperty("CH2 Character Y Position Value 0~720")
        @JsonProperty("ch2_pos_y")
        @PositiveOrZero
        private Short ch2PosY;

        @ApiModelProperty("CH1 Character, Max: 16char(kor),32char(eng)")
        @JsonProperty("ch1_char")
        @Size(min=1, max=32)
        private String ch1Char;

        @ApiModelProperty("CH2 Character, Max: 16char(kor),32char(eng)")
        @JsonProperty("ch2_char")
        @Size(min=1, max=32)
        private String ch2Char;

        @ApiModelProperty("로그인 사용자 ID")
        @JsonProperty("user_id")
        private String userId;

        @Builder
        public CctvVarCharControlSetReq(Integer sector_no, Short start_pan, Short end_pan,
                                        Short ch1_char_size, Short ch1_pos_x, Short ch1_pos_y,
                                        Short ch2_char_size, Short ch2_pos_x, Short ch2_pos_y,
                                        String ch1_char, String ch2_char,
                                        String user_id) {
            this.sectorNo = sector_no;
            this.startPan = start_pan;
            this.endPan = end_pan;
            this.ch1CharSize = ch1_char_size;
            this.ch1PosX = ch1_pos_x;
            this.ch1PosY = ch1_pos_y;
            this.ch2CharSize = ch2_char_size;
            this.ch2PosX = ch2_pos_x;
            this.ch2PosY = ch2_pos_y;
            this.ch1Char = ch1_char;
            this.ch2Char = ch2_char;
            this.userId = user_id;
        }
    }

    @ApiModel("CctvVarCharControlDelReq(CCTV 가변 문자 지우기)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvVarCharControlDelReq {

        @ApiModelProperty("Sector No. 0~6")
        @JsonProperty("sector_no")
        @PositiveOrZero
        private Integer sectorNo;

        @ApiModelProperty("로그인 사용자 ID")
        @JsonProperty("user_id")
        private String userId;

        @Builder
        public CctvVarCharControlDelReq(Integer sector_no, String user_id) {
            this.sectorNo = sector_no;
            this.userId = user_id;
        }
    }

    @ApiModel("CctvVarCharControlRes(CCTV 가변 문자 설정 응답)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvVarCharControlRes {

        @ApiModelProperty("제어결과(0: 성공, 기타: 오류")
        @JsonProperty("error")
        private Integer error;

        @ApiModelProperty("제어결과메시지")
        @JsonProperty("message")
        private String message;

        public void setResult(Integer error, String message) {
            this.error = error;
            this.message = message;
        }
        @Builder
        public CctvVarCharControlRes(Integer error, String message) {
            this.error = error;
            this.message = message;
        }
    }

}
