package cn.reghao.tnb.content.app.chat.model.constant;

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

/**
 * @author reghao
 * @date 2024-12-03 14:36:28
 */
public enum ReceiverType {
    Group(1, "群红包"),
    Single(2, "个人红包");

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

    ReceiverType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

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

    /**
     * 提供给 @ValidEnum 调用
     *
     * @param
     * @return
     * @date 2023-10-11 14:44:42
     */
    public int getValue() {
        return this.code;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

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