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;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2022年04月12日 09:15
 */
@Data
public class OracleTerminalExcel 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 = "终端索引")
    @NotNull(message = "终端索引不能为空")
    private Integer deviceId;

    @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 = "通讯状态", replace = {"中断_0", "正常_1"}, width = 15)
    @NotNull(message = "通讯状态不能为空")
    private Integer comFlag;

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

    @Excel(name = "定检状态", replace = {"未检_0", "已检_1"}, width = 15)
    @NotNull(message = "定检状态不能为空")
    private Integer checkFlag;

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

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

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

    @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 = "前置名称", width = 15)
    @NotBlank(message = "前置名称引不能为空")
    private String nodeName;

    @Excel(name = "投运时间", format = "yyyy-MM-dd", width = 15)
    @NotNull(message = "投运时间不为空")
    private LocalDate loginTime;

    @Excel(name = "数据更新时间", format = "yyyy-MM-dd HH:mm:ss", width = 15)
    @NotNull(message = "数据更新时间不为空")
    private LocalDateTime updateTime;

    @Excel(name = "本次定检时间", format = "yyyy-MM-dd", width = 15)
    @NotNull(message = "本次定检时间不为空")
    private LocalDate thisTimeCheck;

    @Excel(name = "下次定检时间", format = "yyyy-MM-dd", width = 15)
    @NotNull(message = "下次定检时间不为空")
    private LocalDate nextTimeCheck;

    @Excel(name = "对时功能", replace = {"关闭_0", "开启_1"}, width = 15)
    private Integer onTime;

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

    @Excel(name = "电度功能", replace = {"关闭_0", "开启_1","null_0"}, width = 15)
    private Integer electroplate;

    @Excel(name = "母线", width = 15)
    @NotBlank(message = "母线名称不可为空")
    @Pattern(regexp = PatternRegex.DEV_NAME_REGEX, 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)
    private Integer subvModel;

    @Excel(name = "监测点索引", width = 15)
    @NotNull(message = "监测点索引不能为空")
    private Integer id;

    @Excel(name = "监测点名称", width = 15)
    @NotBlank(message = "监测点名称不可为空")

    private String lineName;

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

    @Excel(name = "pt1", width = 15)
    @NotNull(message = "PT一次变比不可为空")
    private Float pt1;

    @Excel(name = "pt2", width = 15)
    @NotNull(message = "PT二次变比不可为空")
    private Float pt2;

    @Excel(name = "ct1", width = 15)
    @NotNull(message = "CT一次变比不可为空")
    private Float ct1;

    @Excel(name = "ct2", width = 15)
    @NotNull(message = "CT二次变比不可为空")
    private Float ct2;

    @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 = "监测点测量间隔不可为空")
    @Range(min = 1, max = 30, message = "取值范围1到30分钟")
    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 = "电网标志", replace = {"电网侧_0", "非电网侧_1"}, width = 15)
    @NotNull(message = "电网标志不为空")
    private Integer powerFlag;

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

    @Excel(name = "电网侧变电站", width = 15)
    private String powerSubstationName;

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

    @Excel(name = "终端等级", width = 15)
    private String lineGrade;

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

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