package cn.iocoder.yudao.module.iot.controller.admin.device.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

@Data
public class DeviceSaveReqVO {

    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "26404")
    private Long id;

    @Schema(description = "设备编号")
    @NotBlank(message = "设备编号不能为空") // 设备编号通常是字符串，且不能是纯空格
    private String deviceCode;

    @Schema(description = "设备名称", example = "赵六")
    @NotBlank(message = "设备名称不能为空") // 设备编号通常是字符串，且不能是纯空格
    private String deviceName;

    @Schema(description = "设备类型", example = "2")
    private String deviceType;

    @Schema(description = "状态", example = "1")
    private String status;

    @Schema(description = "读主题")
    private String readTopic;

    @Schema(description = "写主题")
    private String writeTopic;

    @Schema(description = "网关id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16311")
    private Long gatewayId;

    @Schema(description = "设备品牌id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24731")
    private Long deviceBrandId;

    @Schema(description = "离线间隔", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long offLineDuration;

    @Schema(description = "最后上线时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime lastOnlineTime;

    @Schema(description = "备注", example = "你说的对")
    private String remark;

    @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "是否启用不能为空")
    private Boolean isEnable;

    @Schema(description = "关联设备模型", example = "1")
    @NotNull(message = "关联设备模型ID不能为空")
    private Long deviceModelId;

    @Schema(description = "通讯协议", example = "OPCUA")
    private String protocol;

    @Schema(description = "采集周期", example = "30")
    private Double sampleCycle;

    @Schema(description = "端点url", example = "opc.tcp://127.0.0.1:48401")
    private String url;

    @Schema(description = "用户名", example = "admin")
    private String username;

    @Schema(description = "密码", example = "1234")
    private String password;

    @Schema(description = "是否连接1-连接 2-断开连接", example = "1")
//    @NotNull
    private Integer isConnect;

    @Schema(description = "mqtt订阅主题")
    private String topic;


}