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 {
    contactMsg(1, "联系人消息"),
    commentMsg(2, "评论消息"),
    danmakuMsg(3, "弹幕消息"),
    chargeMsg(4, "充值消息"),
    transferMsg(5, "转帐消息"),
    payMsg(6, "支付消息"),
    sysMsg(7, "系统消息");

    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 Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

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