package com.ltgk.common.enums;


import lombok.Getter;

import java.util.Arrays;

/**
 * 告警枚举类
 *
 * @author Qi ChengBin
 * @date 2025/06/16
 */
@Getter
public enum AlarmConfigEnums {
    // 伏休期出海
    SM_OUT_SEA_CONFIG("休渔期出海告警","smOutSea", "ltgk:alarm:smOutSea:config"),

    ;
    private final String type;
    private final String typeEn;
    private final String redisKey;

    AlarmConfigEnums(String type, String typeEn, String redisKey) {
        this.type = type;
        this.typeEn = typeEn;
        this.redisKey = redisKey;
    }

    /**
     * 根据 typeEn 获取对应的 redisKey
     * @author Qi ChengBin
     * @param typeEn: 告警类型英文
     * @return java.lang.String
     * @date 2025/6/17
     */
    public static String getRedisKeyByTypeEn(String typeEn) {
        return Arrays.stream(values())
                .filter(e -> e.getTypeEn().equals(typeEn))
                .findFirst()
                .map(AlarmConfigEnums::getRedisKey)
                .orElse(null);
    }
}
