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 java.io.Serializable;

/**
 * CCTV 제어기 프리셋제어 DTO Class
 */
@Data
@Builder
@ApiModel("CctvPresetControlDto(CCTV 프리셋제어 정보")
public class CctvPresetControlDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModel("CctvPresetControlReq(CCTV 프리셋제어 정보)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvPresetControlReq {

        @ApiModelProperty("Pan Preset Value")
        @JsonProperty("pan")
        @PositiveOrZero
        private Integer pan;

        @ApiModelProperty("Tilt Preset Value")
        @JsonProperty("tilt")
        @PositiveOrZero
        private Integer tilt;

        @ApiModelProperty("Zoom Preset Value")
        @JsonProperty("zoom")
        @PositiveOrZero
        private Integer zoom;

        @ApiModelProperty("Focus Preset Value")
        @JsonProperty("focus")
        @PositiveOrZero
        private Integer focus;

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

        @Builder
        public CctvPresetControlReq(Integer pan, Integer tilt, Integer zoom, Integer focus, String user_id) {
            this.pan = pan;
            this.tilt = tilt;
            this.zoom = zoom;
            this.focus = focus;
            this.userId = user_id;
        }
    }

    @ApiModel("CctvPresetControlRes(CCTV 프리셋제어 응답)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvPresetControlRes {

        @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 CctvPresetControlRes(Integer error, String message) {
            this.error = error;
            this.message = message;
        }
    }

    @ApiModel("CctvPresetValueRes(CCTV 프리셋 상태 정보)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class CctvPresetValueRes {

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

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

        @ApiModelProperty("Pan Preset Value")
        @JsonProperty("pan")
        @PositiveOrZero
        private Short pan;

        @ApiModelProperty("Tilt Preset Value")
        @JsonProperty("tilt")
        @PositiveOrZero
        private Short tilt;

        @ApiModelProperty("Zoom Preset Value")
        @JsonProperty("zoom")
        @PositiveOrZero
        private Short zoom;

        @ApiModelProperty("Focus Preset Value")
        @JsonProperty("focus")
        @PositiveOrZero
        private Short focus;

        public CctvPresetValueRes(Integer error, String message) {
            this.error = error;
            this.message = message;
            this.pan = 0;
            this.tilt = 0;
            this.zoom = 0;
            this.focus = 0;
        }

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

        public void setValue(Short pan, Short tilt, Short zoom, Short focus) {
            this.pan = pan;
            this.tilt = tilt;
            this.zoom = zoom;
            this.focus = focus;
        }
    }

}
