package cn.iocoder.yudao.module.system.enums.notice;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 *
 * 消息优先级枚举
 * @author jinyd
 */
@AllArgsConstructor
@Getter
public enum NotifyPriorityEnum implements ArrayValuable<Integer> {

    HIGH(20, "高"),
    MEDIUM(50, "中"),
    LOW(100, "低"),
    EMERGENT(10, "紧急");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(NotifyPriorityEnum::getValue).toArray(Integer[]::new);

    /**
     * 类型
     */
    private final Integer value;
    /**
     * 转改名
     */
    private final String name;

    public static NotifyPriorityEnum valueOf(Integer value) {
        return ArrayUtil.firstMatch(businessType -> businessType.getValue().equals(value), NotifyPriorityEnum.values());
    }

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

}
