package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 设备配置表
 * </p>
 *
 * @author lijin
 * @since 2023-06-16
 */
public class DeviceConfigDto {

    @Data
    @Accessors(chain = true)
    public static class Update {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty(value = "设备id")
        private Long deviceId;

        @ApiModelProperty(value = "最大温度告警值")
        private Integer tempMax;

        @ApiModelProperty(value = "最小温度告警值")
        private Integer tempMin;

        @ApiModelProperty(value = "缺货率预警值")
        private Integer stockOutRate;

        @ApiModelProperty(value = "缺货种类预警值")
        private Integer stockOutGoodsNum;

    }

    @Data
    @Accessors(chain = true)
    public static class BatchUpdate {

        @NotEmpty(message = "deviceId不能为空")
        @ApiModelProperty(value = "设备id")
        private List<Long> deviceIds;

        @ApiModelProperty(value = "最大温度告警值")
        private Integer tempMax;

        @ApiModelProperty(value = "最小温度告警值")
        private Integer tempMin;

        @ApiModelProperty(value = "缺货率预警值")
        private Integer stockOutRate;

        @ApiModelProperty(value = "缺货种类预警值")
        private Integer stockOutGoodsNum;

    }

    @Data
    @Accessors(chain = true)
    public static class Obj {

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty(value = "设备id")
        private Long deviceId;
    }


    @Data
    @Accessors(chain = true)
    public static class Vo {

        @ApiModelProperty(value = "设备id")
        private Long deviceId;

        @ApiModelProperty(value = "最大温度告警值")
        private Integer tempMax;

        @ApiModelProperty(value = "最小温度告警值")
        private Integer tempMin;

        @ApiModelProperty(value = "创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;

        @ApiModelProperty(value = "更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;

        @ApiModelProperty(value = "缺货率预警值")
        private Integer stockOutRate;

        @ApiModelProperty(value = "缺货种类预警值")
        private Integer stockOutGoodsNum;
    }

}
