package cn.reghao.tnb.message.api.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 通知类型
 *
 * @author reghao
 * @date 2020-03-01 17:18:53
 */
public enum NotifyType {
    email(1), mobile(2), webhook(3);

    private final int value;
    NotifyType(int value) {
        this.value = value;
    }

    private static Map<Integer, NotifyType> map = new HashMap<>();
    static {
        for (NotifyType type : NotifyType.values()) {
            map.put(type.getValue(), type);
        }
    }

    public String getName() {
        return this.name();
    }

    public Integer getValue() {
        return value;
    }

    public static NotifyType getByCode(int code) {
        return map.get(code);
    }
}
