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

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * Vms 제어기 제어정보 DTO Class
 */
@Data
@Builder
@ApiModel("VmsControlDto(VMS 제어 정보")
public class VmsControlDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModel("VmsControlReq(VMS 제어기 제어 정보)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class VmsControlReq {

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

        //@ApiModelProperty("리셋(0:소프트웨어리셋, 1:하드웨어리셋), 전관판제어(0:On, 1:Off), 휘도제어(0:자동, 1:주간, 2:야간, 3~100:수동)")
        @ApiModelProperty("리셋(0:소프트웨어리셋, 1:하드웨어리셋), 전관판제어(0:On, 1:Off), 휘도제어(0:주간, 1:야간, 2:자동, 9:수동)")
        @JsonProperty("value")
        private Integer value;

        @ApiModelProperty("휘도제어 휘도값-현재")
        @JsonProperty("curr_step")
        private Integer currStep;

        @ApiModelProperty("휘도제어 휘도값-주간")
        @JsonProperty("week_step")
        private Integer weekStep;

        @ApiModelProperty("휘도제어 휘도값-야간")
        @JsonProperty("nght_step")
        private Integer nghtStep;

        @Builder
        public VmsControlReq(String user_id, Integer value) {
            this.userId = user_id;
            this.value = value;
        }
    }
    @ApiModel("VmsControlParamReq(VDS 제어기 파라미터설정)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class VmsControlParamReq {

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

        //@ApiModelProperty("계획된 메시지 동작시간")
        //@JsonProperty("sch_msg_time")
        //@JsonIgnore
        //private Integer schMsgTime;

        //@ApiModelProperty("모듈전원 OFF 온도")
        //@JsonProperty("module_temp")
        //@JsonIgnore
        //private Integer moduleTemp;

        @ApiModelProperty("Fan 동작 기준온도")
        @JsonProperty("fan_run_tmpr")
        private Integer fanRunTmpr;

        @ApiModelProperty("Heater 동작 기준온도")
        @JsonProperty("hetr_run_tmpr")
        private Integer hetrRunTmpr;

        //@ApiModelProperty("모듈장애 판단율")
        //@JsonProperty("module_fail")
        //@JsonIgnore
        //private Integer moduleFail;

        //@ApiModelProperty("재시도 횟수")
        //@JsonProperty("retry_count")
        //@JsonIgnore
        //private Integer retryCount;

        //@ApiModelProperty("최대응답대기시간")
        //@JsonProperty("timeout")
        //@JsonIgnore
        //private Integer timeOut;

        @ApiModelProperty("ON 시각")
        @JsonProperty("panl_on_time")
        private String panlOnTime;

        @ApiModelProperty("OFF 시각")
        @JsonProperty("panl_off_time")
        private String panlOffTime;

        @Builder
//        public VmsControlParamReq(String user_id, Integer sch_msg_time, Integer module_temp, Integer fan_temp, Integer heater_temp, Integer module_fail, Integer retry_count, Integer timeout) {
//            this.userId = user_id;
//            this.schMsgTime = sch_msg_time;
//            this.moduleTemp = module_temp;
//            this.fanTemp = fan_temp;
//            this.heaterTemp = heater_temp;
//            this.moduleFail = module_fail;
//            this.retryCount = retry_count;
//            this.timeOut = timeout;
//        }
        public VmsControlParamReq(String user_id, Integer fan_run_tmpr, Integer hetr_run_tmpr, String panl_on_time, String panl_off_time) {
            this.userId = user_id;
            this.fanRunTmpr = fan_run_tmpr;
            this.hetrRunTmpr = hetr_run_tmpr;
            this.panlOnTime = panl_on_time;
            this.panlOffTime = panl_off_time;
        }

    }

    @ApiModel("VmsControlRes(VMS 제어기 제어 응답)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class VmsControlRes {

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

    @ApiModel("VmsControlOnOffTimeReq(VMS 제어기 전광판 ON-OFF 시각 설정 정보)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class VmsControlOnOffTimeReq {

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

        @ApiModelProperty("ON 시각")
        @JsonProperty("on_time")
        private String onTime;

        @ApiModelProperty("OFF 시각")
        @JsonProperty("off_time")
        private String offTime;

        @Builder
        public VmsControlOnOffTimeReq(String user_id, String on_time, String off_time) {
            this.userId = user_id;
            this.onTime = on_time;
            this.offTime = off_time;
        }
    }

    @ApiModel("VmsControlOprModeReq(VMS 제어기 운영모드 설정 정보)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class VmsControlOprModeReq {

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

        @ApiModelProperty("운영모드(A:자동, F:고정, B:기본)")
        @JsonProperty("opr_mode")
        @Size(min=1, max=1)
        @Pattern(regexp = "[AFB]")
        private String oprMode;

        @Builder
        public VmsControlOprModeReq(String user_id, String opr_mode) {
            this.userId = user_id;
            this.oprMode = opr_mode;
        }
    }

}
