"""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 PackingListFieldsShipperTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The shipper's name"""
    address: NotRequired[str]
    r"""The shipper's address"""
    tax_id: NotRequired[str]
    r"""The shipper's taxpayer identifier"""
    iban: NotRequired[str]
    r"""The shipper's International Bank Account Number"""
    bank_account: NotRequired[str]
    r"""The shipper's bank account"""
    bank_code: NotRequired[str]
    r"""The shipper's bank code"""


class PackingListFieldsShipper(BaseModel):
    name: Optional[str] = None
    r"""The shipper's name"""

    address: Optional[str] = None
    r"""The shipper's address"""

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The shipper's taxpayer identifier"""

    iban: Optional[str] = None
    r"""The shipper's International Bank Account Number"""

    bank_account: Annotated[Optional[str], pydantic.Field(alias="bankAccount")] = None
    r"""The shipper's bank account"""

    bank_code: Annotated[Optional[str], pydantic.Field(alias="bankCode")] = None
    r"""The shipper's bank code"""


class PackingListFieldsConsigneeTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The consignee's name"""
    address: NotRequired[str]
    r"""The consignee's address"""


class PackingListFieldsConsignee(BaseModel):
    name: Optional[str] = None
    r"""The consignee's name"""

    address: Optional[str] = None
    r"""The consignee's address"""


class PackingListFieldsBuyerTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The buyer's name"""
    address: NotRequired[str]
    r"""The buyer's address"""


class PackingListFieldsBuyer(BaseModel):
    name: Optional[str] = None
    r"""The buyer's name"""

    address: Optional[str] = None
    r"""The buyer's address"""


class PackingListFieldsBillToTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The recipient of the invoice's name"""
    address: NotRequired[str]
    r"""The recipient of the invoice's address"""


class PackingListFieldsBillTo(BaseModel):
    name: Optional[str] = None
    r"""The recipient of the invoice's name"""

    address: Optional[str] = None
    r"""The recipient of the invoice's address"""


class PackingListFieldsPurchaseOrderTypedDict(TypedDict):
    number: NotRequired[str]
    r"""The purchase order number"""
    date_: NotRequired[str]
    r"""The date of the corresponding purchase order"""


class PackingListFieldsPurchaseOrder(BaseModel):
    number: Optional[str] = None
    r"""The purchase order number"""

    date_: Annotated[Optional[str], pydantic.Field(alias="date")] = None
    r"""The date of the corresponding purchase order"""


class PackingListFieldsLineItemsTypedDict(TypedDict):
    position: NotRequired[float]
    r"""The number of the item in the list"""
    article_number: NotRequired[str]
    r"""The article number"""
    order_number: NotRequired[str]
    r"""The purchase order number"""
    invoice_number: NotRequired[str]
    r"""The invoice number"""
    country_of_origin: NotRequired[str]
    r"""The country of origin of goods"""
    container_number: NotRequired[str]
    r"""The container (container, box, pallet) number"""
    description: NotRequired[str]
    r"""A description of the goods"""
    quantity: NotRequired[float]
    r"""Number of items of goods delivered to the destination"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the quantity of goods"""
    package_quantity: NotRequired[float]
    r"""The total number of shipments containing the goods"""
    package_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for packages"""
    net_weight: NotRequired[float]
    r"""The net weight of the goods"""
    net_weight_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the net weight"""
    gross_weight: NotRequired[float]
    r"""The gross weight of the goods"""
    gross_weight_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the gross weight"""
    volume: NotRequired[float]
    r"""The volume of the goods"""
    volume_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the volume"""
    dimensions: NotRequired[str]
    r"""The dimensions of the goods"""
    dimensions_unit_of_measurement: NotRequired[str]
    r"""The unit of measurement used for the dimensions"""
    length: NotRequired[float]
    r"""The length of each item in the shipment"""
    width: NotRequired[float]
    r"""The width of each item in the shipment"""
    height: NotRequired[float]
    r"""The height of each item in the shipment"""


class PackingListFieldsLineItems(BaseModel):
    position: Optional[float] = None
    r"""The number of the item in the list"""

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

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

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

    country_of_origin: Annotated[
        Optional[str], pydantic.Field(alias="countryOfOrigin")
    ] = None
    r"""The country of origin of goods"""

    container_number: Annotated[
        Optional[str], pydantic.Field(alias="containerNumber")
    ] = None
    r"""The container (container, box, pallet) number"""

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

    quantity: Optional[float] = None
    r"""Number of items of goods delivered to the destination"""

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

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

    package_unit_of_measurement: Annotated[
        Optional[str], pydantic.Field(alias="packageUnitOfMeasurement")
    ] = None
    r"""The unit of measurement used for packages"""

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

    net_weight_unit_of_measurement: Annotated[
        Optional[str], pydantic.Field(alias="netWeightUnitOfMeasurement")
    ] = 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 goods"""

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

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

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

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

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

    length: Optional[float] = None
    r"""The length of each item in the shipment"""

    width: Optional[float] = None
    r"""The width of each item in the shipment"""

    height: Optional[float] = None
    r"""The height of each item in the shipment"""


class TotalQuantityTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The total number of units of goods"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total quantity"""


class TotalQuantity(BaseModel):
    amount: Optional[float] = None
    r"""The total number of units of goods"""

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


class TotalPackagesTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The total number of shipment units"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total packages"""


class TotalPackages(BaseModel):
    amount: Optional[float] = None
    r"""The total number of shipment units"""

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


class TotalNetWeightTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The net weight of the goods"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total net weight"""


class TotalNetWeight(BaseModel):
    amount: Optional[float] = None
    r"""The net weight of the goods"""

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


class TotalGrossWeightTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The gross weight of the goods"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total gross weight"""


class TotalGrossWeight(BaseModel):
    amount: Optional[float] = None
    r"""The gross weight of the goods"""

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


class TotalVolumeTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The total volume of the goods"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total volume"""


class TotalVolume(BaseModel):
    amount: Optional[float] = None
    r"""The total volume of the goods"""

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


class TotalDimensionsTypedDict(TypedDict):
    amount: NotRequired[float]
    r"""The total dimensions of the goods"""
    unit_of_measurement: NotRequired[str]
    r"""The unit of measurement for the total dimensions"""


class TotalDimensions(BaseModel):
    amount: Optional[float] = None
    r"""The total dimensions of the goods"""

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


class PackingListFieldsTypedDict(TypedDict):
    r"""Fields extracted from a packing list"""

    shipper: NotRequired[PackingListFieldsShipperTypedDict]
    consignee: NotRequired[PackingListFieldsConsigneeTypedDict]
    buyer: NotRequired[PackingListFieldsBuyerTypedDict]
    bill_to: NotRequired[PackingListFieldsBillToTypedDict]
    packing_list_number: NotRequired[str]
    r"""The packing list number"""
    packing_list_date: NotRequired[date]
    r"""The date of the packing list"""
    invoice_number: NotRequired[str]
    r"""The number of the invoice for the shipped goods"""
    invoice_date: NotRequired[date]
    r"""The date of the invoice"""
    purchase_order: NotRequired[List[PackingListFieldsPurchaseOrderTypedDict]]
    bill_of_lading_number: NotRequired[str]
    r"""The bill of lading number"""
    country_of_origin: NotRequired[str]
    r"""The country where the shipped goods were manufactured"""
    country_of_final_destination: NotRequired[str]
    r"""The country of destination of the shipped goods"""
    mode_of_transportation: NotRequired[str]
    r"""The shipment method to be used (AIR, SEA/OCEAN, RAIL, GROUND/TRUCK, Intermodal)"""
    shipping_date: NotRequired[date]
    r"""The date of the shipment"""
    incoterm: NotRequired[str]
    r"""The delivery terms. One of: EXW (EX Works), FCA (Free Carrier), FAS (Free Alongside Ship), FOB (Free On Board), CFR (Cost And Freight), CIF (Cost Insurance Freight), DAP (Delivered At Place), DPU (Delivered at Place Unloaded), CPT (Carriage Paid To), CIP (Carriage Insurance Paid), DDP (Delivered Duty Paid), DDU (Delivered Duty Unpaid)"""
    line_items: NotRequired[List[PackingListFieldsLineItemsTypedDict]]
    total_quantity: NotRequired[TotalQuantityTypedDict]
    total_packages: NotRequired[TotalPackagesTypedDict]
    total_net_weight: NotRequired[TotalNetWeightTypedDict]
    total_gross_weight: NotRequired[TotalGrossWeightTypedDict]
    total_volume: NotRequired[TotalVolumeTypedDict]
    total_dimensions: NotRequired[TotalDimensionsTypedDict]


class PackingListFields(BaseModel):
    r"""Fields extracted from a packing list"""

    shipper: Optional[PackingListFieldsShipper] = None

    consignee: Optional[PackingListFieldsConsignee] = None

    buyer: Optional[PackingListFieldsBuyer] = None

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

    packing_list_number: Annotated[
        Optional[str], pydantic.Field(alias="packingListNumber")
    ] = None
    r"""The packing list number"""

    packing_list_date: Annotated[
        Optional[date], pydantic.Field(alias="packingListDate")
    ] = None
    r"""The date of the packing list"""

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

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

    purchase_order: Annotated[
        Optional[List[PackingListFieldsPurchaseOrder]],
        pydantic.Field(alias="purchaseOrder"),
    ] = None

    bill_of_lading_number: Annotated[
        Optional[str], pydantic.Field(alias="billOfLadingNumber")
    ] = None
    r"""The bill of lading number"""

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

    country_of_final_destination: Annotated[
        Optional[str], pydantic.Field(alias="countryOfFinalDestination")
    ] = None
    r"""The country of destination of the shipped goods"""

    mode_of_transportation: Annotated[
        Optional[str], pydantic.Field(alias="modeOfTransportation")
    ] = None
    r"""The shipment method to be used (AIR, SEA/OCEAN, RAIL, GROUND/TRUCK, Intermodal)"""

    shipping_date: Annotated[Optional[date], pydantic.Field(alias="shippingDate")] = (
        None
    )
    r"""The date of the shipment"""

    incoterm: Optional[str] = None
    r"""The delivery terms. One of: EXW (EX Works), FCA (Free Carrier), FAS (Free Alongside Ship), FOB (Free On Board), CFR (Cost And Freight), CIF (Cost Insurance Freight), DAP (Delivered At Place), DPU (Delivered at Place Unloaded), CPT (Carriage Paid To), CIP (Carriage Insurance Paid), DDP (Delivered Duty Paid), DDU (Delivered Duty Unpaid)"""

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

    total_quantity: Annotated[
        Optional[TotalQuantity], pydantic.Field(alias="totalQuantity")
    ] = None

    total_packages: Annotated[
        Optional[TotalPackages], pydantic.Field(alias="totalPackages")
    ] = None

    total_net_weight: Annotated[
        Optional[TotalNetWeight], pydantic.Field(alias="totalNetWeight")
    ] = None

    total_gross_weight: Annotated[
        Optional[TotalGrossWeight], pydantic.Field(alias="totalGrossWeight")
    ] = None

    total_volume: Annotated[
        Optional[TotalVolume], pydantic.Field(alias="totalVolume")
    ] = None

    total_dimensions: Annotated[
        Optional[TotalDimensions], pydantic.Field(alias="totalDimensions")
    ] = None
