package com.cf.imes.module.system.enums.pay;


import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.excel.core.convert.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

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

@Getter
@AllArgsConstructor
public enum InvoiceStatusEnum implements BaseEnum {


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



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

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


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




}
