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 NotieBusinessTypeEnum implements ArrayValuable<Integer> {

    ORDINARY(0, "一般消息"),
    BPM(1, "审批消息"),
    ALARM(2, "告警");

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

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

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

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

}
