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

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

/**
 * @author reghao
 * @date 2024-09-26 21:55:17
 */
public enum MsgType {
    verifyMsg(1, "验证码消息"),
    loginMsg(2, "登入消息"),
    rtmpMsg(3, "RTMP 消息"),
    contactMsg(4, "联系人消息"),
    commentMsg(5, "评论消息"),
    danmakuMsg(6, "弹幕消息"),
    chargeMsg(7, "充值消息"),
    transferMsg(8, "转帐消息"),
    payMsg(9, "支付消息"),
    sysMsg(10, "系统消息");

    private final int code;
    private final String desc;

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

    public int getValue() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

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