package com.yupi.project.model.enums;

import lombok.Getter;

/**
 * 支付状态枚举
 */
@Getter
public enum PaymentStatusEnum {

    PENDING("PENDING", "待支付"),
    PAID("PAID", "已支付"),
    FAILED("FAILED", "支付失败"),
    REFUNDED("REFUNDED", "已退款"),
    NOT_REQUIRED("NOT_REQUIRED", "无需支付"); // 例如免费活动或内部测试

    private final String value;
    private final String description;

    PaymentStatusEnum(String value, String description) {
        this.value = value;
        this.description = description;
    }

    /**
     * 根据 value 获取枚举
     *
     * @param value
     * @return
     */
    public static PaymentStatusEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (PaymentStatusEnum anEnum : PaymentStatusEnum.values()) {
            if (anEnum.value.equals(value)) {
                return anEnum;
            }
        }
        return null;
    }
} 