package cn.reghao.tnb.auth.app.model.constant;

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

/**
 * 验证码通道类型
 *
 * @author reghao
 * @date 2024-04-17 20:54:00
 */
public enum VerifyChannel {
    registryChannel(1, "注册通道"),
    loginChannel(2, "登入通道"),
    updateChannel(3, "更新手机/邮箱通道"),
    passwordChannel(4, "修改密码通道");

    private final int code;
    private final String desc;

    private static Map<Integer, VerifyChannel> map = new HashMap<>();
    static {
        for (VerifyChannel status : VerifyChannel.values()) {
            map.put(status.code, status);
        }
    }
    VerifyChannel(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getValue() {
        return code;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

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