package com.xydl.cac.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "warning")
@ApiModel("告警信息表")
public class Warning {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ExcelIgnore
    private Integer id;

    @ApiModelProperty("装置ID")
    @Column(name = "sensor_id")
    @ExcelIgnore
    private Integer sensorId;

    @ApiModelProperty("装置名称")
    @Column(name = "sensor_name")
    @ColumnWidth(20)
    @ExcelProperty(value = "装置名称", order = 3)
    private String sensorName;

    @ApiModelProperty("主设备名称")
    @Column(name = "zsb_name")
    @ColumnWidth(20)
    @ExcelProperty(value = "主设备名称", order = 2)
    private String zsbName;

    @ApiModelProperty("规则ID")
    @Column(name = "rule_id")
    @ExcelIgnore
    private Integer ruleId;

    @ApiModelProperty("字段名")
    @Column(name = "field")
    @ExcelIgnore
    private String field;

    @ApiModelProperty("数据采集时间")
    @Column(name = "d_time")
    @ColumnWidth(20)
    @ExcelProperty(value = "数据采集时间", order = 4)
    private Date dTime;

    @ApiModelProperty("告警时间")
    @Column(name = "warn_time")
    @ColumnWidth(20)
    @ExcelProperty(value = "告警时间", order = 1)
    private Date warnTime;

    @ApiModelProperty("当前值")
    @Column(name = "warn_value")
    @ColumnWidth(10)
    @ExcelProperty(value = "当前值", order = 6)
    private String warnValue;

    @ApiModelProperty("阈值")
    @Column(name = "threshold")
    @ColumnWidth(10)
    @ExcelProperty(value = "阈值", order = 9)
    private String threshold;

    @ApiModelProperty("告警信息")
    @Column(name = "warn_desc")
    @ColumnWidth(30)
    @ExcelProperty(value = "告警信息", order = 5)
    private String warnDesc;

    @ApiModelProperty("触发信息")
    @Column(name = "trigger_desc")
    @ColumnWidth(20)
    @ExcelProperty(value = "触发信息", order = 8)
    private String triggerDesc;

    @ApiModelProperty("告警等级 0:低 1:中 2:高")
    @Column(name = "warn_level")
    @ExcelIgnore
    private Integer warnLevel;

    @ApiModelProperty("处理状态")
    @Column(name = "state")
    @ExcelIgnore
    private String state;

    @ApiModelProperty("处理结果描述")
    @Column(name = "process")
    @ExcelIgnore
    private String process;

    @ApiModelProperty("处理人id")
    @Column(name = "process_user")
    @ExcelIgnore
    private String processUser;

    @ApiModelProperty("处理时间")
    @Column(name = "process_time")
    @ExcelIgnore
    private Date processTime;

    @Transient
    @ColumnWidth(10)
    @ExcelProperty(value = "单位", order = 7)
    private String unit;

}