
package com.czg.system.dto;

import java.io.Serializable;
import java.time.LocalDateTime;
import com.alibaba.fastjson2.annotation.JSONField;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.experimental.Accessors;
import java.io.Serial;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 设备管理 实体类。
 *
 * @author ww
 * @since 2025-11-24
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class SysDevicesDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @NotNull(message = "id不能为空", groups = {UpdateGroup.class})
    private Long id;

    /**
     * 设备 sn，收银机用 Mac 地址
     */
    @NotBlank(message = "设备sn不能为空", groups = {UpdateGroup.class, InsertGroup.class})
    private String deviceSn;

    /**
     * 设备类型：scanBox 扫码盒子，cashMachine 收银机，printer 打印机
     */
    @NotBlank(message = "设备类型不能为空", groups = {UpdateGroup.class, InsertGroup.class})
    @Pattern(regexp = "^(scanBox|cashMachine|printer)$", message = "设备类型格式错误")
    private String deviceType;

    /**
     * 连接类型：usb，4g，wifi
     */
    @NotBlank(message = "连接类型不能为空", groups = {UpdateGroup.class, InsertGroup.class})
    @Pattern(regexp = "^(usb|4g|wifi)$", message = "连接类型格式错误")
    private String connType;

    /**
     * 在线状态：0 离线，1 在线
     */
    private Integer onlineStatus;

    /**
     * 最后上线时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastUnlineTime;

    /**
     * 离线时间
     */
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime offlineTime;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

}
