package com.ylx.massage.enums;

import lombok.Getter;

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

    /**
     * 未支付
     */
    UNPAID(0, "未支付"),

    /**
     * 已支付
     */
    PAID(1, "已支付"),

    /**
     * 支付失败
     */
    PAYMENT_FAILED(2, "支付失败"),

    /**
     * 已退款
     */
    REFUNDED(3, "已退款");

    private final Integer code;
    private final String info;

    PaymentStatusEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static String getDescByCode(Integer code) {
        if (code == null) {
            return "";
        }
        for (PaymentStatusEnum value : PaymentStatusEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getInfo();
            }
        }
        return "";
    }
}