package com.haha.common.enums;

import lombok.Getter;

/**
 * 退款状态枚举
 */
@Getter
public enum RefundStatus {

    PENDING("PENDING", "待审核"),
    REFUNDED("REFUNDED", "已退款"),
    REJECTED("REJECTED", "已拒绝");

    private final String code;
    private final String description;

    RefundStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static RefundStatus fromCode(String code) {
        if (code == null) {
            return null;
        }
        for (RefundStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    public static String getDescription(String code) {
        RefundStatus status = fromCode(code);
        return status != null ? status.description : "未知";
    }
}
