package com.cf.imes.module.executor.enums.amount;


import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 发票状态枚举类型
 */

@Getter
@AllArgsConstructor
public enum InvoiceStatusEnum {


    /**
     * 可开票
     */
    INVOICABLE(0, "可开票"),
    /**
     * 待开票
     */
    PENDINGINVOICING(1, "待开票"),
    /**
     * 已开票
     */
    INVOICINGSUCCESSFUL(2,"已开票"),
    /**
     * 开票失败
     */
    INVOICINGFAILED(3,"开票失败");



    /**
     * 状态
     */
    private final Integer status;

    /**
     * 名称
     */
    private final String name;



    public static InvoiceStatusEnum fromType(Integer status) {
        if (status == null) {
            return null;
        }
        for (InvoiceStatusEnum value : values()) {
            if (ObjectUtil.equal(value.getStatus(), status)) {
                return value;
            }
        }
        return null;
    }




}
