package com.fs.live.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 直播行为资源类型枚举
 *
 * @author xw
 * @date 2026-01-05
 */
@Getter
@AllArgsConstructor
public enum LiveBehaviorResourceTypeEnum {

    /** 商品 */
    GOODS(1, "商品"),

    /** 消息 */
    MESSAGE(2, "消息"),

    /** 优惠券 */
    COUPON(3, "优惠券"),

    /** 红包 */
    RED_PACKET(4, "红包"),

    /** 抽奖 */
    LOTTERY(5, "抽奖"),

    /** 订单 */
    ORDER(6, "订单"),

    /** 主播 */
    ANCHOR(7, "主播");

    private final Integer code;
    private final String desc;

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