package com.red.circle.other.domain.propcoupon;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 道具券类型枚举
 *
 * @author system
 * @date 2025-11-05
 */
@Getter
@AllArgsConstructor
public enum PropCouponType {

    /**
     * 头像框
     */
    AVATAR_FRAME(1, "头像框"),

    /**
     * 座驾
     */
    RIDE(2, "座驾"),

    /**
     * VIP
     */
    NOBLE_VIP(3, "VIP"),

    /**
     * 聊天气泡
     */
    CHAT_BUBBLE(4, "聊天气泡"),

    /**
     * 主题
     */
    THEME(5, "主题"),

    /**
     * 资料卡
     */
    DATA_CARD(6, "资料卡"),

    /**
     * 飘屏
     */
    FLOAT_PICTURE(7, "飘屏"),

    /**
     * 徽章
     */
    BADGE(8, "徽章"),

    /**
     * 靓号
     */
    SPECIAL_ID(9, "靓号");

    private final Integer code;
    private final String desc;

    /**
     * 根据code获取枚举
     */
    public static PropCouponType getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (PropCouponType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }

    public static PropCouponType getByName(String name) {
        for (PropCouponType type : values()) {
          if (type.name().equals(name)) {
            return type;
          }
        }
        return null;
    }

}
