"""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 BuyerTypedDict(TypedDict):
    r"""Buyer details"""

    name: NotRequired[str]
    r"""The name of the buyer"""
    tax_id: NotRequired[str]
    r"""The tax identification number of the buyer"""
    buyer_id: NotRequired[str]
    r"""The buyer id"""
    iban: NotRequired[str]
    r"""The buyer's international bank account number"""
    bank_account: NotRequired[str]
    r"""The bank account number of the buyer"""
    bank_code: NotRequired[str]
    r"""The bank code of the buyer"""
    address: NotRequired[str]
    r"""The address of the buyer"""
    country: NotRequired[str]
    r"""The country of the buyer"""
    state: NotRequired[str]
    r"""The state part of the buyer's address"""
    state_or_province: NotRequired[str]
    r"""The state or province part of the buyer's address"""
    city: NotRequired[str]
    r"""The city part of the buyer's address"""
    street: NotRequired[str]
    r"""The street part of the buyer's address"""
    postal_code: NotRequired[str]
    r"""The postal code part of the buyer's address"""
    zip_code: NotRequired[str]
    r"""The ZIP code part of the buyer's address"""


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

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

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

    buyer_id: Annotated[Optional[str], pydantic.Field(alias="buyerId")] = None
    r"""The buyer id"""

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

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

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

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

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

    state: Optional[str] = None
    r"""The state part of the buyer's address"""

    state_or_province: Annotated[
        Optional[str], pydantic.Field(alias="stateOrProvince")
    ] = None
    r"""The state or province part of the buyer's address"""

    city: Optional[str] = None
    r"""The city part of the buyer's address"""

    street: Optional[str] = None
    r"""The street part of the buyer's address"""

    postal_code: Annotated[Optional[str], pydantic.Field(alias="postalCode")] = None
    r"""The postal code part of the buyer's address"""

    zip_code: Annotated[Optional[str], pydantic.Field(alias="zipCode")] = None
    r"""The ZIP code part of the buyer's address"""


class SupplierTypedDict(TypedDict):
    r"""Supplier details"""

    name: NotRequired[str]
    r"""The name of the supplier"""
    tax_id: NotRequired[str]
    r"""The tax identification number of the supplier"""
    supplier_id: NotRequired[str]
    r"""The supplier ID"""
    address: NotRequired[str]
    r"""The address of the supplier"""
    country: NotRequired[str]
    r"""The country of the supplier"""
    state: NotRequired[str]
    r"""The state part of the supplier's address"""
    state_or_province: NotRequired[str]
    r"""The state or province part of the supplier's address"""
    city: NotRequired[str]
    r"""The city part of the supplier's address"""
    street: NotRequired[str]
    r"""The street part of the supplier's address"""
    postal_code: NotRequired[str]
    r"""The postal code part of the supplier's address"""
    zip_code: NotRequired[str]
    r"""The ZIP code part of the supplier's address"""


class Supplier(BaseModel):
    r"""Supplier details"""

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

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

    supplier_id: Annotated[Optional[str], pydantic.Field(alias="supplierId")] = None
    r"""The supplier ID"""

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

    country: Optional[str] = None
    r"""The country of the supplier"""

    state: Optional[str] = None
    r"""The state part of the supplier's address"""

    state_or_province: Annotated[
        Optional[str], pydantic.Field(alias="stateOrProvince")
    ] = None
    r"""The state or province part of the supplier's address"""

    city: Optional[str] = None
    r"""The city part of the supplier's address"""

    street: Optional[str] = None
    r"""The street part of the supplier's address"""

    postal_code: Annotated[Optional[str], pydantic.Field(alias="postalCode")] = None
    r"""The postal code part of the supplier's address"""

    zip_code: Annotated[Optional[str], pydantic.Field(alias="zipCode")] = None
    r"""The ZIP code part of the supplier's address"""


class ShipToTypedDict(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 ShipTo(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 BillToTypedDict(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 BillTo(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 PurchaseOrderFieldsLineItemsTypedDict(TypedDict):
    r"""Line item details"""

    position: NotRequired[float]
    r"""The number of the line item in the list"""
    article_number_buyer: NotRequired[str]
    r"""The article number of the goods in the buyer's database"""
    article_number_supplier: NotRequired[str]
    r"""The article number of the goods in the supplier's database"""
    description: NotRequired[str]
    r"""A description of the goods or services"""
    quantity: NotRequired[float]
    r"""The number of units ordered"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the goods"""
    unit_price: NotRequired[float]
    r"""The price of one item of goods"""
    discount: NotRequired[float]
    r"""The applicable discount in the currency of the purchase order"""
    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 delivery date of the goods in the line item"""


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

    position: Optional[float] = None
    r"""The number of the line item in the list"""

    article_number_buyer: Annotated[
        Optional[str], pydantic.Field(alias="articleNumberBuyer")
    ] = None
    r"""The article number of the goods in the buyer's database"""

    article_number_supplier: Annotated[
        Optional[str], pydantic.Field(alias="articleNumberSupplier")
    ] = None
    r"""The article number of the goods in the supplier's database"""

    description: Optional[str] = None
    r"""A description of the goods or services"""

    quantity: Optional[float] = None
    r"""The number of units ordered"""

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

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

    discount: Optional[float] = None
    r"""The applicable discount in the currency of the purchase order"""

    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 delivery date of the goods in the line item"""


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

    total_net_amount: NotRequired[float]
    r"""The total cost of goods without tax"""
    total_tax_amount: NotRequired[float]
    r"""The total tax amount"""


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

    total_net_amount: Annotated[
        Optional[float], pydantic.Field(alias="totalNetAmount")
    ] = None
    r"""The total cost of goods without tax"""

    total_tax_amount: Annotated[
        Optional[float], pydantic.Field(alias="totalTaxAmount")
    ] = None
    r"""The total tax amount"""


class PurchaseOrderFieldsTypedDict(TypedDict):
    r"""Fields extracted from a purchase order"""

    order_number: NotRequired[str]
    r"""The number of the purchase order"""
    order_date: NotRequired[date]
    r"""The date when the purchase order was created"""
    total: NotRequired[float]
    r"""The total amount of the purchase order"""
    currency: NotRequired[str]
    r"""The currency of the total amount. If no total amount is indicated, this field will be empty."""
    buyer: NotRequired[BuyerTypedDict]
    r"""Buyer details"""
    supplier: NotRequired[SupplierTypedDict]
    r"""Supplier details"""
    delivery_date: NotRequired[date]
    r"""The delivery date of the ordered goods or services"""
    ship_to: NotRequired[ShipToTypedDict]
    r"""The recipient of the goods or services"""
    bill_to: NotRequired[BillToTypedDict]
    r"""The recipient of the invoice"""
    line_items: NotRequired[List[PurchaseOrderFieldsLineItemsTypedDict]]
    r"""List of line items in the invoice"""
    taxes: NotRequired[PurchaseOrderFieldsTaxesTypedDict]
    r"""Tax information"""


class PurchaseOrderFields(BaseModel):
    r"""Fields extracted from a purchase order"""

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

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

    total: Optional[float] = None
    r"""The total amount of the purchase order"""

    currency: Optional[str] = None
    r"""The currency of the total amount. If no total amount is indicated, this field will be empty."""

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

    supplier: Optional[Supplier] = None
    r"""Supplier details"""

    delivery_date: Annotated[Optional[date], pydantic.Field(alias="deliveryDate")] = (
        None
    )
    r"""The delivery date of the ordered goods or services"""

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

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

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

    taxes: Optional[PurchaseOrderFieldsTaxes] = None
    r"""Tax information"""
