"""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 CommercialInvoiceFieldsConsigneeTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the consignee"""
    tax_id: NotRequired[str]
    r"""The international tax ID of the consignee"""
    address: NotRequired[str]
    r"""The address of the consignee"""
    consignee_id: NotRequired[str]
    r"""The unique identifier of the consignee"""
    postal_code: NotRequired[str]
    r"""The postal code of the consignee"""
    street: NotRequired[str]
    r"""The street component of the consignee address"""
    city: NotRequired[str]
    r"""The city component of the consignee address"""
    state_or_province: NotRequired[str]
    r"""The state or province component of the consignee address"""
    country: NotRequired[str]
    r"""The country component of the consignee address"""


class CommercialInvoiceFieldsConsignee(BaseModel):
    name: Optional[str] = None
    r"""The name of the consignee"""

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The international tax ID of the consignee"""

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

    consignee_id: Annotated[Optional[str], pydantic.Field(alias="consigneeId")] = None
    r"""The unique identifier of the consignee"""

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

    street: Optional[str] = None
    r"""The street component of the consignee address"""

    city: Optional[str] = None
    r"""The city component of the consignee address"""

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

    country: Optional[str] = None
    r"""The country component of the consignee address"""


class CommercialInvoiceFieldsVendorTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the sender of the goods"""
    tax_id: NotRequired[str]
    r"""The international tax ID of the sender of the goods"""
    address: NotRequired[str]
    r"""The address of the sender of the goods"""
    vendor_id: NotRequired[str]
    r"""The unique identifier of the sender of the goods"""
    postal_code: NotRequired[str]
    r"""The postal code of the sender of the goods"""
    street: NotRequired[str]
    r"""The Street component of the sender of the goods address"""
    city: NotRequired[str]
    r"""The City component of the sender of the goods address"""
    state_or_province: NotRequired[str]
    r"""The State or Province component of the sender of the goods address"""
    country: NotRequired[str]
    r"""The Country component of the sender of the goods address"""
    national_tax_id: NotRequired[str]
    r"""The national tax ID of the sender of the goods"""
    iban: NotRequired[str]
    r"""The IBAN (International Bank Account Number) of the sender of the goods"""
    bank_code: NotRequired[str]
    r"""The bank code of the sender of the goods"""
    bank_account: NotRequired[str]
    r"""The bank account of the sender of the goods"""


class CommercialInvoiceFieldsVendor(BaseModel):
    name: Optional[str] = None
    r"""The name of the sender of the goods"""

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The international tax ID of the sender of the goods"""

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

    vendor_id: Annotated[Optional[str], pydantic.Field(alias="vendorId")] = None
    r"""The unique identifier of the sender of the goods"""

    postal_code: Annotated[Optional[str], pydantic.Field(alias="postalCode")] = None
    r"""The postal code of the sender of the goods"""

    street: Optional[str] = None
    r"""The Street component of the sender of the goods address"""

    city: Optional[str] = None
    r"""The City component of the sender of the goods address"""

    state_or_province: Annotated[
        Optional[str], pydantic.Field(alias="stateOrProvince")
    ] = None
    r"""The State or Province component of the sender of the goods address"""

    country: Optional[str] = None
    r"""The Country component of the sender of the goods address"""

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

    iban: Optional[str] = None
    r"""The IBAN (International Bank Account Number) of the sender of the goods"""

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

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


class CommercialInvoiceFieldsShipToTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the recipient of the goods"""
    address: NotRequired[str]
    r"""The address of the recipient of the goods"""


class CommercialInvoiceFieldsShipTo(BaseModel):
    name: Optional[str] = None
    r"""The name of the recipient of the goods"""

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


class CommercialInvoiceFieldsBillToTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the recipient of the invoice for the goods specified in the document"""
    address: NotRequired[str]
    r"""The address of the recipient of the invoice for the goods specified in the document"""


class CommercialInvoiceFieldsBillTo(BaseModel):
    name: Optional[str] = None
    r"""The name of the recipient of the invoice for the goods specified in the document"""

    address: Optional[str] = None
    r"""The address of the recipient of the invoice for the goods specified in the document"""


class CommercialInvoiceFieldsAdditionalCostsTypedDict(TypedDict):
    type: NotRequired[str]
    r"""The type of additional cost"""
    amount: NotRequired[float]
    r"""The amount of the additional cost"""
    currency: NotRequired[str]
    r"""The currency of the additional cost"""


class CommercialInvoiceFieldsAdditionalCosts(BaseModel):
    type: Optional[str] = None
    r"""The type of additional cost"""

    amount: Optional[float] = None
    r"""The amount of the additional cost"""

    currency: Optional[str] = None
    r"""The currency of the additional cost"""


class CommercialInvoiceFieldsLineItemsTypedDict(TypedDict):
    position: NotRequired[float]
    r"""The number of the line item"""
    country_of_origin: NotRequired[str]
    r"""The country where the line item was manufactured"""
    hs_code: NotRequired[str]
    r"""The Harmonized System code of the goods"""
    description: NotRequired[str]
    r"""A description of the line item"""
    quantity: NotRequired[float]
    r"""The number of units purchased"""
    uom: NotRequired[str]
    r"""The unit of measurement used for the line item"""
    unit_price: NotRequired[float]
    r"""The price of one unit of the goods"""
    total_price: NotRequired[float]
    r"""The total price of the line item, including additional charges and discounts"""
    currency: NotRequired[str]
    r"""The currency of the line item"""
    net_weight: NotRequired[float]
    r"""The net weight of the line item (that is, without the packaging)"""
    net_weight_uom: NotRequired[str]
    r"""The unit of measurement used for the net weight"""
    gross_weight: NotRequired[float]
    r"""The gross weight of the line item (that is, with the packaging)"""
    gross_weight_uom: NotRequired[str]
    r"""The unit of measurement used for the gross weight"""


class CommercialInvoiceFieldsLineItems(BaseModel):
    position: Optional[float] = None
    r"""The number of the line item"""

    country_of_origin: Annotated[
        Optional[str], pydantic.Field(alias="countryOfOrigin")
    ] = None
    r"""The country where the line item was manufactured"""

    hs_code: Annotated[Optional[str], pydantic.Field(alias="hsCode")] = None
    r"""The Harmonized System code of the goods"""

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

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

    uom: Optional[str] = None
    r"""The unit of measurement used for the line item"""

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

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

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

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

    net_weight_uom: Annotated[Optional[str], pydantic.Field(alias="netWeightUom")] = (
        None
    )
    r"""The unit of measurement used for the net weight"""

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

    gross_weight_uom: Annotated[
        Optional[str], pydantic.Field(alias="grossWeightUom")
    ] = None
    r"""The unit of measurement used for the gross weight"""


class CommercialInvoiceFieldsTypedDict(TypedDict):
    r"""Fields extracted from a commercial invoice"""

    consignee: NotRequired[CommercialInvoiceFieldsConsigneeTypedDict]
    vendor: NotRequired[CommercialInvoiceFieldsVendorTypedDict]
    ship_to: NotRequired[CommercialInvoiceFieldsShipToTypedDict]
    bill_to: NotRequired[CommercialInvoiceFieldsBillToTypedDict]
    invoice_number: NotRequired[str]
    r"""The number of the invoice"""
    invoice_date: NotRequired[date]
    r"""The date on which the invoice was issued"""
    due_date: NotRequired[date]
    r"""The date by which the invoice should be paid"""
    country_of_origin: NotRequired[str]
    r"""The country where the goods were manufactured"""
    country_of_export: NotRequired[str]
    r"""The country from which the goods are being exported"""
    country_of_destination: NotRequired[str]
    r"""The country into which the goods are being imported"""
    inco_term: NotRequired[str]
    r"""The terms of shipment"""
    weight: NotRequired[float]
    r"""The total weight of the goods"""
    weight_uom: NotRequired[str]
    r"""The unit of measurement used for the weight of the goods"""
    total_pallets: NotRequired[float]
    r"""The total number of pallets containing the goods"""
    total: NotRequired[float]
    r"""The total price of the goods"""
    currency: NotRequired[str]
    r"""The currency of the price"""
    additional_costs: NotRequired[List[CommercialInvoiceFieldsAdditionalCostsTypedDict]]
    line_items: NotRequired[List[CommercialInvoiceFieldsLineItemsTypedDict]]


class CommercialInvoiceFields(BaseModel):
    r"""Fields extracted from a commercial invoice"""

    consignee: Optional[CommercialInvoiceFieldsConsignee] = None

    vendor: Optional[CommercialInvoiceFieldsVendor] = None

    ship_to: Annotated[
        Optional[CommercialInvoiceFieldsShipTo], pydantic.Field(alias="shipTo")
    ] = None

    bill_to: Annotated[
        Optional[CommercialInvoiceFieldsBillTo], pydantic.Field(alias="billTo")
    ] = None

    invoice_number: Annotated[Optional[str], pydantic.Field(alias="invoiceNumber")] = (
        None
    )
    r"""The number of the invoice"""

    invoice_date: Annotated[Optional[date], pydantic.Field(alias="invoiceDate")] = None
    r"""The date on which the invoice was issued"""

    due_date: Annotated[Optional[date], pydantic.Field(alias="dueDate")] = None
    r"""The date by which the invoice should be paid"""

    country_of_origin: Annotated[
        Optional[str], pydantic.Field(alias="countryOfOrigin")
    ] = None
    r"""The country where the goods were manufactured"""

    country_of_export: Annotated[
        Optional[str], pydantic.Field(alias="countryOfExport")
    ] = None
    r"""The country from which the goods are being exported"""

    country_of_destination: Annotated[
        Optional[str], pydantic.Field(alias="countryOfDestination")
    ] = None
    r"""The country into which the goods are being imported"""

    inco_term: Annotated[Optional[str], pydantic.Field(alias="incoTerm")] = None
    r"""The terms of shipment"""

    weight: Optional[float] = None
    r"""The total weight of the goods"""

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

    total_pallets: Annotated[Optional[float], pydantic.Field(alias="totalPallets")] = (
        None
    )
    r"""The total number of pallets containing the goods"""

    total: Optional[float] = None
    r"""The total price of the goods"""

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

    additional_costs: Annotated[
        Optional[List[CommercialInvoiceFieldsAdditionalCosts]],
        pydantic.Field(alias="additionalCosts"),
    ] = None

    line_items: Annotated[
        Optional[List[CommercialInvoiceFieldsLineItems]],
        pydantic.Field(alias="lineItems"),
    ] = None
