package com.ycwl.basic.order.enums;

/**
 * 支付状态枚举
 */
public enum PaymentStatus {
    
    /**
     * 未支付
     */
    UNPAID("UNPAID", "未支付"),
    
    /**
     * 已支付
     */
    PAID("PAID", "已支付"),
    
    /**
     * 已退款
     */
    REFUNDED("REFUNDED", "已退款");
    
    private final String code;
    private final String description;
    
    PaymentStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据code获取枚举
     */
    public static PaymentStatus fromCode(String code) {
        for (PaymentStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown PaymentStatus code: " + code);
    }
}