package com.yuchen.saas.payment.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/9/15 15:18
 * @Description: 订单中心发票状态枚举类型
 */
@Getter
@AllArgsConstructor
public enum OrderManageInvoiceStatusEnum {


    /**
     * 开票中
     */
    WAITING(0, "开票中"),
    /**
     * 开票成功
     */
    SUCCESS(1, "开票成功"),

    /**
     * 未开票
     */
    NO(9, "未开票");


    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        OrderManageInvoiceStatusEnum[] enumArray = OrderManageInvoiceStatusEnum.values();
        for (OrderManageInvoiceStatusEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }
}
