package com.ycwl.basic.order.enums;

/**
 * 退款类型枚举
 */
public enum RefundType {
    
    /**
     * 全额退款
     */
    FULL_REFUND("FULL_REFUND", "全额退款"),
    
    /**
     * 部分退款
     */
    PARTIAL_REFUND("PARTIAL_REFUND", "部分退款"),
    
    /**
     * 商品退款
     */
    ITEM_REFUND("ITEM_REFUND", "商品退款");
    
    private final String code;
    private final String description;
    
    RefundType(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据code获取枚举
     */
    public static RefundType fromCode(String code) {
        for (RefundType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown RefundType code: " + code);
    }
}