package com.ruoyi.ems.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.huashe.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 告警处置记录对象 adm_op_alarm_handle
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AlarmHandle extends BaseEntity {
    private static final long serialVersionUID = 1L;

    private Long id;

    /** 告警ID */
    private String alarmId;

    /** 处置类型 1:确认 2:派单 3:处置 4:关闭 5:备注 */
    private Integer handleType;

    /** 处置内容 */
    private String handleContent;

    /** 处置结果 */
    private String handleResult;

    /** 处置人 */
    private String handleBy;

    /** 处置时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date handleTime;

    /** 附件(JSON) */
    private String attachments;

    // ==================== 处置类型常量 ====================

    public static final int TYPE_CONFIRM = 1;   // 确认
    public static final int TYPE_DISPATCH = 2;  // 派单
    public static final int TYPE_HANDLE = 3;    // 处置
    public static final int TYPE_CLOSE = 4;     // 关闭
    public static final int TYPE_REMARK = 5;    // 备注

    /**
     * 获取处置类型描述
     */
    public String getHandleTypeDesc() {
        if (handleType == null) {
            return "未知";
        }
        switch (handleType) {
            case TYPE_CONFIRM:
                return "确认";
            case TYPE_DISPATCH:
                return "派单";
            case TYPE_HANDLE:
                return "处置";
            case TYPE_CLOSE:
                return "关闭";
            case TYPE_REMARK:
                return "备注";
            default:
                return "未知";
        }
    }
}