package com.xy.dto;

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

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * <p>
 * 设备版本升级记录表
 * </p>
 *
 * @author lijin
 * @since 2023-06-09
 */
public class DeviceVersionUpDto {

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

        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

    }

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

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

        @NotBlank(message = "deviceVersion不能为空")
        @ApiModelProperty(value = "版本号")
        private String deviceVersion;


        @ApiModelProperty(value = "修改 累加发送次数")
        private Integer accumSendNum;
    }

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

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty(value = "设备ID", required = true)
        private Long deviceId;

        @NotBlank(message = "deviceVersion不能为空")
        @ApiModelProperty(value = "版本号")
        private String deviceVersion;

        @NotNull(message = "progress不能为空")
        @ApiModelProperty(value = "进度百分比")
        private Integer progress;

        @NotNull(message = "status不能为空")
        @ApiModelProperty(value = "状态")
        private Integer status;

        @NotBlank(message = "msg不能为空")
        @ApiModelProperty(value = "说明")
        private String msg;
    }

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

        @ApiModelProperty(value = "id")
        private Long id;

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

        @ApiModelProperty(value = "appKey")
        private String appKey;

        @ApiModelProperty(value = "版本号")
        private String deviceVersion;

        @ApiModelProperty(value = "发送次数")
        private Integer sendNum;

        @ApiModelProperty(value = "状态")
        private Integer status;

        @ApiModelProperty(value = "指令值")
        private String cmdValue;

        @ApiModelProperty(value = "升级进度百分比")
        private Integer progress;

        @ApiModelProperty(value = "升级说明")
        private String msg;

        @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;


    }

}
