import type { ElectronicInvoiceSyntax } from "./detectElectronicInvoice"

export type ElectronicInvoiceItem = {
    description: string
    quantity: number | null
    unitCode: string | null
    netAmount: number
    taxRate: number
    taxCategory: string | null
    taxAmount: number
    grossAmount: number
}

export type ParsedElectronicInvoice = {
    syntax: ElectronicInvoiceSyntax
    profileId: string | null
    invoiceNumber: string | null
    invoiceDate: string | null
    dueDate: string | null
    currency: string | null
    invoiceType: "invoice" | "credit-note"
    seller: {
        name: string | null
        vatId: string | null
        taxNumber: string | null
        iban: string | null
        bic: string | null
    }
    buyerReference: string | null
    paymentMeansCode: string | null
    items: ElectronicInvoiceItem[]
    totals: {
        lineNet: number | null
        tax: number | null
        gross: number | null
        payable: number | null
    }
    validation: {
        errors: string[]
        warnings: string[]
    }
}
