package com.njcn.gather.device.pojo.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.pojo.constant.DetectionValidMessage;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * @author caozehui
 * @data 2024/11/7
 * @description 省级平台设备Excel导入导出实体类
 */
@Data
public class ProvinceDevExcel implements Serializable {

    private static final long serialVersionUID = 1L;

    @Excel(name = "装置编号*", width = 20)
    @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
    private String createId;

    @Excel(name = "设备名称*", width = 20, orderNum = "2")
    @NotBlank(message = DetectionValidMessage.NAME_NOT_BLANK)
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = DetectionValidMessage.NAME_FORMAT_ERROR)
    private String name;

    @Excel(name = "设备类型*", width = 20, orderNum = "3")
    @NotBlank(message = DetectionValidMessage.DEV_TYPE_NOT_BLANK)
    private String devType;

    @Excel(name = "设备厂家*", width = 20, orderNum = "7")
    @NotBlank(message = DetectionValidMessage.MANUFACTURER_NOT_BLANK)
    private String manufacturer;

    @Excel(name = "出厂日期（yyyy-MM-dd）*", width = 25, format = "yyyy-MM-dd", orderNum = "8")
    @NotNull(message = DetectionValidMessage.CREATEDATETIME_NOT_NULL)
    private LocalDate createDate;

    @Excel(name = "固件版本", width = 15, orderNum = "9")
    private String hardwareVersion;

    @Excel(name = "软件版本", width = 15, orderNum = "10")
    private String softwareVersion;

    @Excel(name = "通讯协议*", width = 15, orderNum = "11")
    @NotBlank(message = DetectionValidMessage.PROTOCOL_NOT_BLANK)
    private String protocol;

    @Excel(name = "是否加密*", width = 20, replace = {"否_0", "是_1"}, orderNum = "12")
    @NotNull(message = DetectionValidMessage.ENCRYPTION_NOT_NULL)
    private Integer encryptionFlag;

    @Excel(name = "识别码（当加密时必填）", width = 30, orderNum = "13")
    private String series;

    @Excel(name = "秘钥（当加密时必填）", width = 30, orderNum = "14")
    private String devKey;

//    @Excel(name = "是否支持系数校准*", width = 25, replace = {"否_0", "是_1"}, orderNum = "15")
//    private Integer factorFlag;

    @Excel(name = "IP地址*", width = 20, orderNum = "15")
    @NotBlank(message = DetectionValidMessage.IP_NOT_BLANK)
    @Pattern(regexp = PatternRegex.IP_REGEX, message = DetectionValidMessage.IP_FORMAT_ERROR)
    private String ip;

    @Excel(name = "端口号*", width = 15, orderNum = "16")
    @NotNull(message = DetectionValidMessage.PORT_NOT_NULL)
    @Range(min = 1, max = 65535, message = DetectionValidMessage.PORT_RANGE_ERROR)
    private Integer port;

    @Excel(name = "样品编号", width = 20, orderNum = "17")
    private String sampleId;

    @Excel(name = "送样日期（yyyy-MM-dd）", width = 25, format = "yyyy-MM-dd", orderNum = "18")
    private LocalDate arrivedDate;

    @Excel(name="委托方", width = 40, orderNum = "19")
    private String delegate;
}
