package com.jianshui.platform.enums;

/**
* @Author: kk
* @Description: 发票状态枚举：BillINfo票据  Invoice发票  RedInfo红字
*/
public enum InvoiceStatus {

    INVOICE_NOT_INVOICED("0", "未开票"),
    INVOICE_INVOICING("20", "开票中"),
    INVOICE_COMPLETED("2", "开票完成"),
    INVOICE_FAILED("22", "开票失败"),
    INVOICE_RED_FLAGGED("99", "已冲红"),
    INVOICE_CANCELLED("3", "已作废"),
    INVOICE_MERGED("18", "已合并"),
    INVOICE_SIGNING("21", "开票成功签章中"),
    INVOICE_SIGNING_FAILED("24", "开票成功签章失败"),
    INVOICE_CANCELLING("31", "发票作废中"),
    INVOICE_RED_FLAGGING("98", "冲红中"),
    INVOICE_SPLIT("17", "已拆分"),
    INVOICE_UNSIGNED("23", "开票成功未签章"),
    INVOICE_PARTIAL_RED("25", "部分冲红"),

    // RedInfo
    REDINFO_APPLICATION_PENDING("0", "申请中"),
    REDINFO_APPROVAL_SUCCESS("1", "审核成功"),
    REDINFO_APPROVAL_FAILED("2", "审核失败"),
    REDINFO_APPLICATION_SUCCESS("3", "申请成功"),
    REDINFO_APPLICATION_FAILED("4", "申请失败");


    private String code;
    private String displayName;

    private InvoiceStatus(String code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }

    public String getCode() {
        return code;
    }

    public String getDisplayName() {
        return displayName;
    }

    public static InvoiceStatus fromCode(String code) {
        for (InvoiceStatus type : InvoiceStatus.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid InvoiceType code: " + code);
    }
    
}
