package com.cpp.web.domain.alarm;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cpp.web.domain.BaseCppEntity;
import com.cpp.web.domain.enums.AlarmEnum;
import com.cpp.web.domain.enums.DataSourcesEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 异常告警实体（包括站端云端中心侧的关键信息）
 *
 * @author tl
 * @date 2024-09-23 15:28:33
 */
@Data
@TableName("cpp_abnormal_alarm")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "cpp_abnormal_alarm")
public class AbnormalAlarm extends BaseCppEntity {

    /**
     * 告警来源
     */
    private DataSourcesEnum alarmSource;


    /**
     * 告警类型
     */
    private AlarmEnum alarmType;


    /**
     * 告警详情
     */
    private String msg;

    /**
     * 告警状态 1:已确认 0：未确认
     */
    private Integer status = 0;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date startTime = new Date();

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date endTime;

    public AbnormalAlarm(DataSourcesEnum alarmSource, AlarmEnum alarmType, String msg, String stationCode) {
        this.alarmSource = alarmSource;
        this.alarmType = alarmType;
        this.msg = msg;
        super.setStationCode(stationCode);
    }

    public AbnormalAlarm() {}
}
