///
import { PathLike } from 'fs';
import { BaseInvoice, BaseCompanyInfo, Vat } from '../models';
import { BigNumber } from '../utilities/big-number.utilities';
import { PdfMakeColumn, PdfMakeContent, PdfMakeDocumentDefinition, PdfMakeDynamicContent, PdfMakeImageDefinition, PdfMakeTableCell } from '../utilities/pdf.utilities';
/**
* Handles the generation of invoice pdfs.
* Uses pdfmake.
*/
export declare abstract class BasePdfService {
/**
* The font size that should be used for the footer.
* @default 10
*/
protected readonly FOOTER_FONT_SIZE: number;
/**
* The currency used for formatting prices.
* @default 'USD'
*/
protected readonly CURRENCY: string;
/**
* The locale to use for formatting dates.
* @default 'en-US'
*/
protected readonly LOCALE: string;
/**
* The timezone to use for formatting dates.
* @default 'America/New_York'
*/
protected readonly TIMEZONE: string;
/**
* Globally defined images which can be referenced by name inside the document definition.
* @default undefined
*/
protected readonly IMAGES?: Record;
/**
* Available options:
*
* - A reference by name to an image defined in PdfMakeDocumentDefinition.images
* - A data URL
* - A remote URL via http:// or https://.
*
* Supported image formats: JPEG, PNG.
* @default undefined
*/
protected readonly LOGO?: string;
/**
* The label for the phone number on the invoice.
* @default 'Phone'
*/
protected readonly PHONE_LABEL: string;
/**
* The label for the email on the invoice.
* @default 'E-Mail'
*/
protected readonly EMAIL_LABEL: string;
/**
* The headline of the invoice.
* @default 'Invoice'
*/
protected readonly HEADLINE: string;
/**
* The font size of the headline.
* @default 20
*/
protected readonly HEADLINE_FONT_SIZE: number;
/**
* The label for the invoice number on the invoice.
* @default 'Invoice No.'
*/
protected readonly INVOICE_NUMBER_LABEL: string;
/**
* The notice below the invoice number.
* @default 'Please specify when making payments and invoicing!'
*/
protected readonly INVOICE_NUMBER_NOTICE: string;
/**
* The label for the date on the invoice.
* @default 'Date'
*/
protected readonly DATE_LABEL: string;
/**
* The label for the date of performance on the invoice.
* @default 'Date of performance'
*/
protected readonly PERFORMANCE_DATE_LABEL: string;
/**
* Whether or not a performance date should be displayed on the invoice.
* @default false
*/
protected readonly SHOW_PERFORMANCE_DATE: boolean;
/**
* Whether or not a due date should be displayed on the invoice.
* @default true
*/
protected readonly SHOW_DUE_DATE: boolean;
/**
* The label for the due date on the invoice.
* @default 'Due date'
*/
protected readonly DUE_DATE_LABEL: string;
/**
* The font size that should be used inside the tables.
* @default 12
*/
protected readonly TABLE_FONT_SIZE: number;
/**
* The label for item name on the invoice.
* @default 'Name'
*/
protected readonly ITEM_NAME_LABEL: string;
/**
* The label for the total when no taxes exist on the invoice.
* @default 'Total'
*/
protected readonly TOTAL_LABEL: string;
/**
* The label for the total before tax value on the invoice.
* @default 'Total (excl. tax)'
*/
protected readonly TOTAL_BEFORE_TAX_LABEL: string;
/**
* The label for the total after tax value on the invoice.
* @default 'Total (incl. tax)'
*/
protected readonly TOTAL_AFTER_TAX_LABEL: string;
/**
* The label for tax value on the invoice.
* @default 'VAT'
*/
protected readonly TAX_LABEL: string;
/**
* The label for tax number on the invoice.
* @default 'Tax number:'
*/
protected readonly TAX_NUMBER_LABEL: string;
/**
* The label for the ceo on the invoice.
* @default 'CEO:'
*/
protected readonly CEO_LABEL: string;
/**
* The label for item amount on the invoice.
* @default 'Amount'
*/
protected readonly ITEM_AMOUNT_LABEL: string;
/**
* The label for single price of an item on the invoice.
* @default 'Price'
*/
protected readonly ITEM_SINGLE_PRICE_LABEL: string;
/**
* The label for total price of an item on the invoice.
* @default 'Total'
*/
protected readonly ITEM_TOTAL_PRICE_LABEL: string;
/**
* The tax office to display in the footer.
* Can be omitted.
*/
protected abstract readonly TAX_OFFICE?: string;
/**
* The label for the bank details in the footer.
*/
protected readonly BANK_DETAILS_LABEL: string;
/**
* The label for the iban to display in the footer.
* @default 'IBAN:'
*/
protected readonly IBAN_LABEL: string;
/**
* The label for the bic to display in the footer.
* @default 'BIC/SWIFT:'
*/
protected readonly BIC_LABEL: string;
/**
* The bank name to display in the footer.
* Can be omitted.
*/
protected abstract readonly BANK_NAME?: string;
/**
* Information about the company like the address.
*/
protected abstract readonly companyInfo: CompanyInfo;
/**
* Creates a pdf for the provided invoice and handles it afterwards.
* @param invoice - The invoice to create the pdf for.
*/
createInvoicePdf(invoice: Invoice): Promise;
/**
* Converts the pdf at the given path to pdf-a.
* @param pdfFilePath - The path to the pdf that should be converted.
* @throws When there was an error in the script.
*/
pdfToPdfA(pdfFilePath: string | PathLike): void;
/**
* Attaches an X-Rechnung to the invoice pdf at the given path.
* @param pdfFilePath - The path of the invoice pdf that the X-Rechnung should be attached to.
* @param invoice - The invoice data.
*/
pdfToXRechnung(pdfFilePath: string, invoice: Invoice): Promise;
/**
* Converts the invoice pdf at the given path to conform to the factur-x invoice standard.
* @param pdfFilePath - The path of the invoice pdf that should be transformed.
* @param invoice - The invoice data.
* @param producer - The producer that should be set. Defaults to `lbx-invoice`.
*/
/**
* What to do with the pdf after it has been created.
* @param pdfData - The pdf content in the form of a base 64 string.
*/
protected abstract handleFinishedInvoicePdf(pdfData: string, invoice: Invoice): unknown;
/**
* Generates a pdfmake document definition for the given invoice.
* @param invoice - The invoice to generate the document definition for.
* @returns The invoice document definition.
*/
protected generateInvoiceDocumentDefinition(invoice: Invoice): PdfMakeDocumentDefinition;
/**
* Gets all relevant tax groups for the pdf file.
* @param invoice - The invoice to get the tax groups for.
* @returns The tax groups for the pdf.
*/
protected getTaxGroups(invoice: Invoice): Vat[];
/**
* Gets the table that displays the total price of all items.
* @param invoice - The invoice to get the table from.
* @param taxGroups - The different tax groups that need to be taken into consideration.
* @returns The total price of all items and the tax groups.
*/
protected getTotalTable(invoice: Invoice, taxGroups: Vat[]): PdfMakeContent;
/**
* Gets the body of the total table.
* @param invoice - The invoice to build the body from.
* @param taxGroups - The different tax groups that need to be taken into consideration.
* @returns The body of the total table.
*/
protected getTotalBody(invoice: Invoice, taxGroups: Vat[]): PdfMakeTableCell[][];
/**
* Gets the table that displays all invoice items.
* @param invoice - The invoice to build the table from.
* @param taxGroups - The different tax groups that need to be taken into consideration.
* @returns The table with all invoice items.
*/
protected getInvoiceItemsTable(invoice: Invoice, taxGroups: Vat[]): PdfMakeContent;
/**
* Gets the body of the invoice items table.
* @param invoice - The invoice to build the body from.
* @param taxGroups - The different tax groups that need to be taken into consideration.
* @returns The body of the invoice items table.
*/
protected getInvoiceItemsBody(invoice: Invoice, taxGroups: Vat[]): PdfMakeTableCell[][];
/**
* Gets the headers for the invoice items table. If the only tax group is 0, the tax column is removed.
* @param taxGroups - The different tax groups that need to be taken into consideration.
* @returns The headers of the invoice items table.
*/
protected getInvoiceItemsHeaders(taxGroups: Vat[]): PdfMakeTableCell[];
/**
* Formats the given number as a price.
* Uses the locale and currency values of this class.
* @param value - The number to format as a price.
* @returns A string representation of the number, including the currency symbol etc.
*/
protected formatPrice(value: number): string;
/**
* Formats the given number as a percentage.
* Uses the locale of this class.
* @param value - The number to format as a percentage.
* @returns A string representation of the number, including the percentage symbol.
*/
protected formatPercent(value: number | BigNumber): string;
/**
* Gets the text that should be displayed before the actual invoice items start.
* @param paragraphs - The paragraphs to get the text from.
* @returns The text that should be displayed before the actual invoice items.
*/
protected getContentFromParagraphs(paragraphs: string[]): PdfMakeContent[];
/**
* Gets the headline of the invoice.
* @returns The headline.
*/
protected getHeadline(): PdfMakeContent;
/**
* Gets the invoice number and the dates.
* @param invoice - The invoice to build the content from.
* @returns The content containing the invoice number and the date, performance date and due date.
*/
protected getNumberAndDates(invoice: Invoice): PdfMakeContent;
/**
* Formats the given date using the locale and timezone.
* @param date - The date to format.
* @returns The formatted date string with the locale and timezone.
*/
protected formatDate(date: Date): string;
/**
* Gets the Content of the header.
* @returns A row with the logo or an empty array if no logo has been specified.
*/
protected getHeader(): PdfMakeDynamicContent | PdfMakeContent;
/**
* Gets the letterhead.
* @param invoice - The invoice to get the letterhead from.
* @returns The letterhead of the customer and the company.
*/
protected getLetterhead(invoice: Invoice): PdfMakeContent;
/**
* Gets the letterhead of the company.
* @returns The letterhead of the company, containing full name, address and contact information.
*/
protected getCompanyLetterheadColumn(): PdfMakeColumn;
/**
* Gets the letterhead of the customer.
* @param invoice - The invoice to get the customer letterhead from.
* @returns The letterhead of the customer, containing the name and address.
*/
protected getCustomerLetterheadColumn(invoice: Invoice): PdfMakeColumn;
/**
* Gets the font size for the provided company address line.
* Checks if the address line is too big and makes the font smaller accordingly.
* @param companyAddressLine - The company address line of the invoice.
* @returns The font size to use for the letter head.
*/
protected getFontSizeForLetterhead(companyAddressLine: string): number;
/**
* Gets the Content of the footer.
* @returns Multiple rows containing information about the company and payment data.
*/
protected getFooter(): PdfMakeDynamicContent | PdfMakeContent;
/**
* Gets the first column of the footer.
* @returns The column definition.
*/
protected getFirstFooterColumn(): PdfMakeColumn;
/**
* Gets the second column of the footer.
* @returns The column definition.
*/
protected getSecondFooterColumn(): PdfMakeColumn;
}