package com.njcn.device.pq.pojo.bo.excel;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.device.pq.pojo.constant.DeviceValidMessage;
import lombok.Data;
import lombok.EqualsAndHashCode;
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.math.BigDecimal;

/**
 * 终端台账导入
 * @author cdf
 * @date 2022/5/17
 */
@Data
public class TerminalBaseExcel implements Serializable {


    @Excel(name = "*项目", width = 15)
    @NotBlank(message = DeviceValidMessage.PROJECT_NAME_NOT)
    @Pattern(regexp = PatternRegex.DEPT_NAME_REGEX, message = DeviceValidMessage.PROJECT_NAME_RULE)
    private String projectName;

    @Excel(name = "*省份", width = 15)
    @NotBlank(message = DeviceValidMessage.PROVINCE_NAME_NOT)
    private String provinceName;

    @Excel(name = "*供电公司", width = 15)
    @NotBlank(message = "供电公司名称")
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "供电公司名称违规")
    private String gdName;

    @Excel(name = "*变电站", width = 15)
    @NotBlank(message = "变电站名称不可为空")
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "变电站名称违规")
    private String substationName;

    @Excel(name = "*变电站电压等级", width = 15)
    @NotBlank(message = "变电站电压等级不可为空")
    private String subStationScale;

    @Excel(name = "*经度", width = 15)
    private BigDecimal lng;

    @Excel(name = "*纬度", width = 15)
    private BigDecimal lat;

    @Excel(name = "*装置名称", width = 15)
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = "装置名称违规")
    private String deviceName;

    @Excel(name = "*终端模型", replace = {"虚拟设备_0", "实际设备_1", "离线设备_2"}, width = 15)
    @NotNull(message = "设备模型不能为空")
    private Integer devModel;

    @Excel(name = "*数据类型", replace = {"暂态系统_0", "稳态系统_1", "双系统_2"}, width = 15)
    @NotNull(message = "数据类型不能为空")
    private Integer devDataType;

    @Excel(name = "*运行状态", replace = {"投运_0", "热备用_1", "停运_2"}, width = 15)
    @NotNull(message = "运行状态不能为空")
    private Integer runFlag;


    @Excel(name = "*终端厂家", width = 15)
    @NotBlank(message = "终端厂家不能为空")
    private String manufacturer;

    @Excel(name = "*设备型号", width = 15)
    @NotBlank(message = "设备型号不能为空")
    private String devType;

    @Excel(name = "*网络参数", width = 15)
    @NotBlank(message = "设备网络参数不能为空")
    private String ip;

    @Excel(name = "*端口", width = 15)
    @Range(min = 1, max = 100000, message = "端口号违规")
    @NotNull(message = "设备端口号不能为空")
    private Integer port;

    @Excel(name = "终端识别码", width = 15)
    private String series;

    @Excel(name = "终端秘钥", width = 15)
    private String devKey;

    @Excel(name = "*召唤标志",replace = {"周期触发_0", "变为触发_1"}, width = 15)
    @NotNull(message = "召唤标志不为空")
    private Integer callFlag;

    @Excel(name = "*前置名称", width = 15)
    @NotBlank(message = "前置名称不能为空")
    private String nodeName;

    @Excel(name = "*前置类型", width = 15)
    @NotBlank(message = "前置类型不能为空")
    private String frontType;

    @Excel(name = "合同号", width = 15)
    private String contract;

    @Excel(name = "SIM卡号", width = 15)
    private String sim;

    @Excel(name = "*母线", width = 15)
    @NotBlank(message = "母线名称不能为空")
    private String subvName;

    @Excel(name = "*母线号", width = 15)
    @NotNull(message = "母线号不为空")
    private Integer subvNum;

    @Excel(name = "*母线电压等级", width = 15)
    @NotBlank(message = "母线电压等级不能为空")
    private String subvScale;

    @Excel(name = "*母线模型", replace = {"虚拟母线_0", "实际母线_1"}, width = 15)
    @NotNull(message = "母线模型不为空")
    private Integer subvModel;


    @Excel(name = "*监测点名称", width = 15)
    @NotBlank(message = "监测点名称不能为空")
    private String lineName;

    @Excel(name = "*监测点线路号", width = 15)
    @NotNull(message = "监测点线路号不为空")
    private Integer lineNum;

    @Excel(name = "*监测点等级", width = 15)
    private String lineGrade;

    @Excel(name = "*pt(格式pt1/pt2)", width = 20)
    @NotBlank(message = "pt不能为空")
    private String pt;

    @Excel(name = "*ct(格式ct1/ct2)", width = 20)
    @NotBlank(message = "ct不能为空")
    private String ct;

    @Excel(name = "*设备容量", width = 15)
    @NotNull(message = "设备容量不为空")
    private Float devCapacity;

    @Excel(name = "*短路容量", width = 15)
    @NotNull(message = "短路容量不为空")
    private Float shortCapacity;

    @Excel(name = "*基准容量", width = 15)
    @NotNull(message = "基准容量不为空")
    private Float standardCapacity;

    @Excel(name = "*协议容量", width = 15)
    @NotNull(message = "协议容量不为空")
    private Float dealCapacity;

    @Excel(name = "*接线方式", replace = {"星型接法_0", "三角型接法_1", "开口三角型接法_2"}, width = 15)
    @NotNull(message = "接线方式不为空")
    private Integer ptType;

    @Excel(name = "*测量间隔", width = 15)
    @NotNull(message = "测量间隔不为空")
    private Integer timeInterval;

    @Excel(name = "*干扰源类型", width = 15)
    @NotBlank(message = "干扰源类型不为空")
    private String loadType;

    @Excel(name = "*行业类型", width = 15)
    @NotBlank(message = "行业类型不为空")
    private String businessType;

    @Excel(name = "国网监测点号", width = 15)
    private String monitorId;

    @Excel(name = "监测点对象名称", width = 15)
    private String objName;

    @Excel(name = "*电网侧标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
    @NotNull(message = "电网侧标志不为空")
    private Integer powerFlag;

    @Excel(name = "*人为干预统计", replace = {"不参与统计_0", "参与统计_1"}, width = 15)
    @NotNull(message = "统计标志不为空")
    private Integer statFlag;

    @Excel(name = "备注", width = 15)
    private String remark;

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class TerminalBaseExcelMsg extends TerminalBaseExcel implements Serializable {
        @Excel(name = "错误信息描述", width = 30)
        private String msg;
    }
}
