package com.jeesharp.business.modules.member.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 华为 IAP 业务订单-退款状态（预留）
 *
 * @author jeesharp
 */
@Getter
@AllArgsConstructor
public enum IapRefundStatusEnum {

    NONE(0, "无"),
    PROCESSING(1, "处理中"),
    SUCCESS(2, "退款成功"),
    FAILED(3, "退款失败");

    private final Integer value;
    private final String desc;

    public static IapRefundStatusEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (IapRefundStatusEnum e : values()) {
            if (e.value.equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static String getDescByValue(Integer value) {
        IapRefundStatusEnum e = fromValue(value);
        return e != null ? e.getDesc() : "";
    }
}
