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.NotBlank;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @author lijin
 * @since 2023-02-17
 */
public class MqttUserDto {

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

    }

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

        @NotBlank(message = "sn不能为空")
        @ApiModelProperty("sn号")
        private String sn;
    }


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

        @ApiModelProperty("唯一标识")
        private Integer id;

        @ApiModelProperty("sn号")
        private String sn;

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

        @ApiModelProperty("账号")
        private String username;

        @ApiModelProperty("密码")
        private String passwordHash;

        private String salt;

        private Boolean isSuperuser;

        @ApiModelProperty("订阅topic")
        private String topic;

        @ApiModelProperty("系统当前时间")
        private Long serverTime;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime created;

        @ApiModelProperty("连接地址")
        private String ipAddress;

        @ApiModelProperty("服务地址")
        private String serverUrl;

    }

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

        @ApiModelProperty("算法id")
        private Long algorithmId;

        @ApiModelProperty("设备类型")
        private Integer deviceType;

        @ApiModelProperty("屏幕类型")
        private Integer screenType;

        @ApiModelProperty("设备型号")
        private String deviceModel;

        @ApiModelProperty("配件集合")
        private List<DevicePartDto.Vo> deviceParts;
    }
}
