package com.starry.admin.modules.shop.module.constant;

import lombok.Getter;

/**
 * 优惠券使用状态
 */
@Getter
public enum CouponUseState {
    UNUSED("1"),
    USED("2"),
    RECYCLED("3");

    private final String code;

    CouponUseState(String code) {
        this.code = code;
    }

    public static CouponUseState fromCode(String code) {
        for (CouponUseState state : values()) {
            if (state.code.equals(code)) {
                return state;
            }
        }
        throw new IllegalArgumentException("Unknown coupon use state code: " + code);
    }
}
