package com.ycwl.basic.pricing.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 优惠券状态枚举
 */
@Getter
@AllArgsConstructor
public enum CouponStatus {
    
    CLAIMED("claimed", "已领取"),
    USED("used", "已使用"),
    EXPIRED("expired", "已过期");
    
    private final String code;
    private final String description;
    
    /**
     * 根据代码获取枚举
     */
    public static CouponStatus fromCode(String code) {
        for (CouponStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown coupon status code: " + code);
    }
}