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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 道具券来源枚举
 *
 * @author system
 * @date 2025-11-05
 */
@Getter
@AllArgsConstructor
public enum PropCouponSource {

    /**
     * 后台赠送
     */
    ADMIN_GRANT(1, "后台赠送"),

    /**
     * 活动获得
     */
    ACTIVITY(2, "活动获得"),

    /**
     * 用户赠送
     */
    USER_GIFT(3, "用户赠送");

    private final Integer code;
    private final String desc;

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