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

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel;
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;
import java.util.List;

/**
 * @author caozehui
 * @data 2025-05-07
 */
@Data
public class ContrastDevExcel implements Serializable {

    private String id;

    @Excel(name = "所属地市*", width = 30, needMerge = true, orderNum = "1")
    private String cityName;

    @Excel(name = "所属供电公司*", width = 30, needMerge = true, orderNum = "2")
    private String gdName;

    @Excel(name = "所属电站*", width = 30, needMerge = true, orderNum = "3")
    private String subName;

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

    @Excel(name = "设备序列号", width = 20, needMerge = true, orderNum = "5")
//    @NotBlank(message = DetectionValidMessage.FACTORYNO_NOT_BLANK)
    private String createId;

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

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

//    @Excel(name = "被检通道", width = 20, needMerge = true, orderNum = "8")
//    private String inspectChannel;

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

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

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

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

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

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

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

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

    @Excel(name = "投运日期（yyyy-MM-dd）*", width = 30, needMerge = true, orderNum = "16", format = "yyyy-MM-dd")
    @NotNull(message = DetectionValidMessage.CREATE_DATE_NOT_NULL)
    private LocalDate createDate;

    @Excel(name = "定检日期（yyyy-MM-dd）*", width = 30, needMerge = true, orderNum = "17", format = "yyyy-MM-dd")
    @NotNull(message = DetectionValidMessage.INSPECT_DATE_NOT_NULL)
    private LocalDate inspectDate;

    @Excel(name = "谐波系统设备id", width = 30, needMerge = true, orderNum = "18")
//    @NotBlank(message = DetectionValidMessage.HARM_SYS_ID_NOT_BLANK)
    private String harmSysId;

    @ExcelCollection(name = "监测点信息", orderNum = "19")
    private List<PqMonitorExcel> pqMonitorExcelList;
}
