package com.ycwl.basic.order.enums;

/**
 * 退款状态枚举
 */
public enum RefundStatus {
    
    /**
     * 无退款
     */
    NO_REFUND("NO_REFUND", "无退款"),
    
    /**
     * 部分退款
     */
    PARTIAL_REFUND("PARTIAL_REFUND", "部分退款"),
    
    /**
     * 全额退款
     */
    FULL_REFUND("FULL_REFUND", "全额退款"),
    
    /**
     * 退款处理中
     */
    REFUND_PROCESSING("REFUND_PROCESSING", "退款处理中");
    
    private final String code;
    private final String description;
    
    RefundStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据code获取枚举
     */
    public static RefundStatus fromCode(String code) {
        for (RefundStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown RefundStatus code: " + code);
    }
}