"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from abbyy_document_ai.types import BaseModel
from datetime import date
import pydantic
from typing import List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class DeliveryNoteFieldsBuyerTypedDict(TypedDict):
    r"""Buyer details"""

    buyer_id: NotRequired[str]
    r"""The unique identifier of the buyer in an external system"""
    name: NotRequired[str]
    r"""The name of the buyer"""
    address: NotRequired[str]
    r"""The address of the buyer"""
    tax_id: NotRequired[str]
    r"""The tax identification number of the buyer"""
    iban: NotRequired[str]
    r"""The buyer's international bank account number"""


class DeliveryNoteFieldsBuyer(BaseModel):
    r"""Buyer details"""

    buyer_id: Annotated[Optional[str], pydantic.Field(alias="buyerId")] = None
    r"""The unique identifier of the buyer in an external system"""

    name: Optional[str] = None
    r"""The name of the buyer"""

    address: Optional[str] = None
    r"""The address of the buyer"""

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The tax identification number of the buyer"""

    iban: Optional[str] = None
    r"""The buyer's international bank account number"""


class DeliveryNoteFieldsVendorTypedDict(TypedDict):
    r"""Vendor details"""

    vendor_id: NotRequired[str]
    r"""The unique identifier of the vendor in an external system"""
    name: NotRequired[str]
    r"""The name of the vendor"""
    address: NotRequired[str]
    r"""The address of the vendor"""
    tax_id: NotRequired[str]
    r"""The tax identification number of the vendor"""
    national_tax_id: NotRequired[str]
    r"""The national tax ID of the vendor"""
    iban: NotRequired[str]
    r"""The international bank account number of the vendor"""
    bank_code: NotRequired[str]
    r"""The bank code of the vendor"""
    bank_account: NotRequired[str]
    r"""The bank account number of the vendor"""


class DeliveryNoteFieldsVendor(BaseModel):
    r"""Vendor details"""

    vendor_id: Annotated[Optional[str], pydantic.Field(alias="vendorId")] = None
    r"""The unique identifier of the vendor in an external system"""

    name: Optional[str] = None
    r"""The name of the vendor"""

    address: Optional[str] = None
    r"""The address of the vendor"""

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The tax identification number of the vendor"""

    national_tax_id: Annotated[Optional[str], pydantic.Field(alias="nationalTaxId")] = (
        None
    )
    r"""The national tax ID of the vendor"""

    iban: Optional[str] = None
    r"""The international bank account number of the vendor"""

    bank_code: Annotated[Optional[str], pydantic.Field(alias="bankCode")] = None
    r"""The bank code of the vendor"""

    bank_account: Annotated[Optional[str], pydantic.Field(alias="bankAccount")] = None
    r"""The bank account number of the vendor"""


class DeliveryNoteFieldsShipToTypedDict(TypedDict):
    r"""The recipient of the goods or services"""

    name: NotRequired[str]
    r"""The name of the recipient of the goods or services"""
    address: NotRequired[str]
    r"""The address where the goods must be delivered"""


class DeliveryNoteFieldsShipTo(BaseModel):
    r"""The recipient of the goods or services"""

    name: Optional[str] = None
    r"""The name of the recipient of the goods or services"""

    address: Optional[str] = None
    r"""The address where the goods must be delivered"""


class DeliveryNoteFieldsBillToTypedDict(TypedDict):
    r"""The recipient of the invoice"""

    name: NotRequired[str]
    r"""The name of the recipient of the invoice"""
    address: NotRequired[str]
    r"""The address where the invoice must be sent"""


class DeliveryNoteFieldsBillTo(BaseModel):
    r"""The recipient of the invoice"""

    name: Optional[str] = None
    r"""The name of the recipient of the invoice"""

    address: Optional[str] = None
    r"""The address where the invoice must be sent"""


class AmountsTypedDict(TypedDict):
    r"""Amount information"""

    total: NotRequired[float]
    r"""The total amount specified in the delivery note"""
    currency: NotRequired[str]
    r"""The currency of the total amount"""


class Amounts(BaseModel):
    r"""Amount information"""

    total: Optional[float] = None
    r"""The total amount specified in the delivery note"""

    currency: Optional[str] = None
    r"""The currency of the total amount"""


class DeliveryNoteFieldsTaxesTypedDict(TypedDict):
    r"""Tax information"""

    tax: NotRequired[float]
    r"""The total tax amount"""


class DeliveryNoteFieldsTaxes(BaseModel):
    r"""Tax information"""

    tax: Optional[float] = None
    r"""The total tax amount"""


class AdditionalCostsTypedDict(TypedDict):
    r"""Additional costs"""

    additional_cost: NotRequired[float]


class AdditionalCosts(BaseModel):
    r"""Additional costs"""

    additional_cost: Annotated[
        Optional[float], pydantic.Field(alias="additionalCost")
    ] = None


class DeliveryNoteFieldsLineItemsTypedDict(TypedDict):
    r"""Line item details"""

    item_number: NotRequired[str]
    r"""The item number"""
    order_number: NotRequired[str]
    r"""The order number"""
    article_number: NotRequired[str]
    r"""The article number"""
    description: NotRequired[str]
    r"""A description of the line item"""
    quantity_ordered: NotRequired[float]
    r"""The number of units ordered"""
    unit_price: NotRequired[float]
    r"""The price of one item of goods"""
    total_price: NotRequired[float]
    r"""The price of the line item including tax"""
    currency: NotRequired[str]
    r"""The currency of the line item"""
    delivery_date: NotRequired[date]
    r"""The planned delivery date for the line item"""
    quantity_delivered: NotRequired[float]
    r"""The number of units delivered"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the goods"""
    net_weight: NotRequired[float]
    r"""The net weight of the line item"""
    gross_weight: NotRequired[float]
    r"""The gross weight of the line item"""
    weight_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the weight of the line item (kilograms, pounds, etc.)"""
    serial_number: NotRequired[str]
    r"""A unique identifier assigned to each item of goods"""
    batch_number: NotRequired[str]
    r"""A unique identifier assigned to a specific group or batch of items that are being transported or delivered together"""
    ean_number: NotRequired[str]
    r"""A unique identifier from the European Article Numbering (EAN) system"""


class DeliveryNoteFieldsLineItems(BaseModel):
    r"""Line item details"""

    item_number: Annotated[Optional[str], pydantic.Field(alias="itemNumber")] = None
    r"""The item number"""

    order_number: Annotated[Optional[str], pydantic.Field(alias="orderNumber")] = None
    r"""The order number"""

    article_number: Annotated[Optional[str], pydantic.Field(alias="articleNumber")] = (
        None
    )
    r"""The article number"""

    description: Optional[str] = None
    r"""A description of the line item"""

    quantity_ordered: Annotated[
        Optional[float], pydantic.Field(alias="quantityOrdered")
    ] = None
    r"""The number of units ordered"""

    unit_price: Annotated[Optional[float], pydantic.Field(alias="unitPrice")] = None
    r"""The price of one item of goods"""

    total_price: Annotated[Optional[float], pydantic.Field(alias="totalPrice")] = None
    r"""The price of the line item including tax"""

    currency: Optional[str] = None
    r"""The currency of the line item"""

    delivery_date: Annotated[Optional[date], pydantic.Field(alias="deliveryDate")] = (
        None
    )
    r"""The planned delivery date for the line item"""

    quantity_delivered: Annotated[
        Optional[float], pydantic.Field(alias="quantityDelivered")
    ] = None
    r"""The number of units delivered"""

    unit_of_measurement: Annotated[
        Optional[str], pydantic.Field(alias="unitOfMeasurement")
    ] = None
    r"""The unit of measurement used for the goods"""

    net_weight: Annotated[Optional[float], pydantic.Field(alias="netWeight")] = None
    r"""The net weight of the line item"""

    gross_weight: Annotated[Optional[float], pydantic.Field(alias="grossWeight")] = None
    r"""The gross weight of the line item"""

    weight_unit_of_measurement: Annotated[
        Optional[str], pydantic.Field(alias="weightUnitOfMeasurement")
    ] = None
    r"""The unit of measurement for the weight of the line item (kilograms, pounds, etc.)"""

    serial_number: Annotated[Optional[str], pydantic.Field(alias="serialNumber")] = None
    r"""A unique identifier assigned to each item of goods"""

    batch_number: Annotated[Optional[str], pydantic.Field(alias="batchNumber")] = None
    r"""A unique identifier assigned to a specific group or batch of items that are being transported or delivered together"""

    ean_number: Annotated[Optional[str], pydantic.Field(alias="eanNumber")] = None
    r"""A unique identifier from the European Article Numbering (EAN) system"""


class DeliveryNoteFieldsTypedDict(TypedDict):
    r"""Fields extracted from a delivery note"""

    buyer: NotRequired[DeliveryNoteFieldsBuyerTypedDict]
    r"""Buyer details"""
    vendor: NotRequired[DeliveryNoteFieldsVendorTypedDict]
    r"""Vendor details"""
    ship_to: NotRequired[DeliveryNoteFieldsShipToTypedDict]
    r"""The recipient of the goods or services"""
    bill_to: NotRequired[DeliveryNoteFieldsBillToTypedDict]
    r"""The recipient of the invoice"""
    delivery_note_number: NotRequired[str]
    r"""The number of the delivery note"""
    delivery_note_date: NotRequired[date]
    r"""The date on which the delivery note was issued"""
    delivery_date: NotRequired[date]
    r"""The date on which the goods are expected to be delivered"""
    due_date: NotRequired[date]
    r"""The date on which the goods are expected to be delivered"""
    shipping_date: NotRequired[date]
    r"""The date on which the goods are shipped"""
    purchaser_name: NotRequired[str]
    r"""The name of the buyer"""
    purchase_order_number: NotRequired[str]
    r"""The purchase order number (if one is specified in the document)"""
    purchase_order_date: NotRequired[date]
    r"""The date when the purchase order was created"""
    invoice_number: NotRequired[str]
    r"""The invoice number (if one is specified in the document)"""
    delivery_terms: NotRequired[str]
    r"""The delivery terms"""
    amounts: NotRequired[AmountsTypedDict]
    r"""Amount information"""
    taxes: NotRequired[List[DeliveryNoteFieldsTaxesTypedDict]]
    r"""Tax information"""
    additional_costs: NotRequired[AdditionalCostsTypedDict]
    r"""Additional costs"""
    total_net_weight: NotRequired[float]
    r"""The total net weight of the goods"""
    total_gross_weight: NotRequired[float]
    r"""The total gross weight of the goods"""
    weight_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the weight of the goods (kilograms, pounds, etc.)"""
    line_items: NotRequired[List[DeliveryNoteFieldsLineItemsTypedDict]]
    r"""List of line items in the invoice"""


class DeliveryNoteFields(BaseModel):
    r"""Fields extracted from a delivery note"""

    buyer: Optional[DeliveryNoteFieldsBuyer] = None
    r"""Buyer details"""

    vendor: Optional[DeliveryNoteFieldsVendor] = None
    r"""Vendor details"""

    ship_to: Annotated[
        Optional[DeliveryNoteFieldsShipTo], pydantic.Field(alias="shipTo")
    ] = None
    r"""The recipient of the goods or services"""

    bill_to: Annotated[
        Optional[DeliveryNoteFieldsBillTo], pydantic.Field(alias="billTo")
    ] = None
    r"""The recipient of the invoice"""

    delivery_note_number: Annotated[
        Optional[str], pydantic.Field(alias="deliveryNoteNumber")
    ] = None
    r"""The number of the delivery note"""

    delivery_note_date: Annotated[
        Optional[date], pydantic.Field(alias="deliveryNoteDate")
    ] = None
    r"""The date on which the delivery note was issued"""

    delivery_date: Annotated[Optional[date], pydantic.Field(alias="deliveryDate")] = (
        None
    )
    r"""The date on which the goods are expected to be delivered"""

    due_date: Annotated[Optional[date], pydantic.Field(alias="dueDate")] = None
    r"""The date on which the goods are expected to be delivered"""

    shipping_date: Annotated[Optional[date], pydantic.Field(alias="shippingDate")] = (
        None
    )
    r"""The date on which the goods are shipped"""

    purchaser_name: Annotated[Optional[str], pydantic.Field(alias="purchaserName")] = (
        None
    )
    r"""The name of the buyer"""

    purchase_order_number: Annotated[
        Optional[str], pydantic.Field(alias="purchaseOrderNumber")
    ] = None
    r"""The purchase order number (if one is specified in the document)"""

    purchase_order_date: Annotated[
        Optional[date], pydantic.Field(alias="purchaseOrderDate")
    ] = None
    r"""The date when the purchase order was created"""

    invoice_number: Annotated[Optional[str], pydantic.Field(alias="invoiceNumber")] = (
        None
    )
    r"""The invoice number (if one is specified in the document)"""

    delivery_terms: Annotated[Optional[str], pydantic.Field(alias="deliveryTerms")] = (
        None
    )
    r"""The delivery terms"""

    amounts: Optional[Amounts] = None
    r"""Amount information"""

    taxes: Optional[List[DeliveryNoteFieldsTaxes]] = None
    r"""Tax information"""

    additional_costs: Annotated[
        Optional[AdditionalCosts], pydantic.Field(alias="additionalCosts")
    ] = None
    r"""Additional costs"""

    total_net_weight: Annotated[
        Optional[float], pydantic.Field(alias="totalNetWeight")
    ] = None
    r"""The total net weight of the goods"""

    total_gross_weight: Annotated[
        Optional[float], pydantic.Field(alias="totalGrossWeight")
    ] = None
    r"""The total gross weight of the goods"""

    weight_unit_of_measurement: Annotated[
        Optional[str], pydantic.Field(alias="weightUnitOfMeasurement")
    ] = None
    r"""The unit of measurement for the weight of the goods (kilograms, pounds, etc.)"""

    line_items: Annotated[
        Optional[List[DeliveryNoteFieldsLineItems]], pydantic.Field(alias="lineItems")
    ] = None
    r"""List of line items in the invoice"""
