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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 华为 IAP 业务订单-发货（履约）状态
 *
 * @author jeesharp
 */
@Getter
@AllArgsConstructor
public enum IapFulfillStatusEnum {

    PENDING(0, "待发货"),
    FULFILLED(1, "已发货"),
    FAILED(2, "发货失败"),
    REVERSED(3, "已冲正");

    private final Integer value;
    private final String desc;

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

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