"""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 ArrivalNoticeFieldsShipperTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The shipper's name"""
    address: NotRequired[str]
    r"""The shipper's address"""


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

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


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


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

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


class NotifyPartyTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the company to be notified of the arrival of the cargo"""
    address: NotRequired[str]
    r"""The address of the company to be notified of the arrival of the cargo"""


class NotifyParty(BaseModel):
    name: Optional[str] = None
    r"""The name of the company to be notified of the arrival of the cargo"""

    address: Optional[str] = None
    r"""The address of the company to be notified of the arrival of the cargo"""


class CarrierTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The carrier's name"""
    scac_code: NotRequired[str]
    r"""The Standard Carrier Alpha Code"""


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

    scac_code: Annotated[Optional[str], pydantic.Field(alias="scacCode")] = None
    r"""The Standard Carrier Alpha Code"""


class ArrivalNoticeFieldsBillToTypedDict(TypedDict):
    r"""Information about the recipient of the invoice"""

    name: NotRequired[str]
    r"""The name of the recipient of the invoice"""
    address: NotRequired[str]
    r"""The address of the recipient of the invoice"""


class ArrivalNoticeFieldsBillTo(BaseModel):
    r"""Information about 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 of the recipient of the invoice"""


class ContainersNotInTableTypedDict(TypedDict):
    container_number: NotRequired[str]
    r"""The number of the container"""
    seal_number: NotRequired[str]
    r"""The number of the seal"""
    size_type: NotRequired[str]
    r"""The size and type of the container"""


class ContainersNotInTable(BaseModel):
    container_number: Annotated[
        Optional[str], pydantic.Field(alias="containerNumber")
    ] = None
    r"""The number of the container"""

    seal_number: Annotated[Optional[str], pydantic.Field(alias="sealNumber")] = None
    r"""The number of the seal"""

    size_type: Annotated[Optional[str], pydantic.Field(alias="sizeType")] = None
    r"""The size and type of the container"""


class ContainersTypedDict(TypedDict):
    container_number: NotRequired[str]
    r"""The number of the container"""
    seal_number: NotRequired[str]
    r"""The number of the seal"""
    seal_value: NotRequired[str]
    r"""The value of the seal"""
    size_type: NotRequired[str]
    r"""The size and type of the container"""
    number_of_packages: NotRequired[float]
    r"""The number of packages"""
    weight_metric: NotRequired[float]
    r"""The weight in metric units"""
    weight_uom_metric: NotRequired[str]
    r"""The unit of measurement used for the weight (kilos)"""
    weight_nonmetric: NotRequired[float]
    r"""The weight in non-metric units"""
    weight_uom_nonmetric: NotRequired[str]
    r"""The unit of measurement used for the weight (lbs)"""
    volume_metric: NotRequired[float]
    r"""The volume in metric units"""
    volume_uom_metric: NotRequired[str]
    r"""The unit of measurement used for the volume (cubic meters)"""
    volume_nonmetric: NotRequired[float]
    r"""The volume in non-metric units"""
    volume_uom_nonmetric: NotRequired[str]
    r"""The unit of measurement used for the volume (liters, cubic feet, etc.)"""
    arrival_date: NotRequired[str]
    r"""The arrival date"""


class Containers(BaseModel):
    container_number: Annotated[
        Optional[str], pydantic.Field(alias="containerNumber")
    ] = None
    r"""The number of the container"""

    seal_number: Annotated[Optional[str], pydantic.Field(alias="sealNumber")] = None
    r"""The number of the seal"""

    seal_value: Annotated[Optional[str], pydantic.Field(alias="sealValue")] = None
    r"""The value of the seal"""

    size_type: Annotated[Optional[str], pydantic.Field(alias="sizeType")] = None
    r"""The size and type of the container"""

    number_of_packages: Annotated[
        Optional[float], pydantic.Field(alias="numberOfPackages")
    ] = None
    r"""The number of packages"""

    weight_metric: Annotated[Optional[float], pydantic.Field(alias="weightMetric")] = (
        None
    )
    r"""The weight in metric units"""

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

    weight_nonmetric: Annotated[
        Optional[float], pydantic.Field(alias="weightNonmetric")
    ] = None
    r"""The weight in non-metric units"""

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

    volume_metric: Annotated[Optional[float], pydantic.Field(alias="volumeMetric")] = (
        None
    )
    r"""The volume in metric units"""

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

    volume_nonmetric: Annotated[
        Optional[float], pydantic.Field(alias="volumeNonmetric")
    ] = None
    r"""The volume in non-metric units"""

    volume_uom_nonmetric: Annotated[
        Optional[str], pydantic.Field(alias="volumeUomNonmetric")
    ] = None
    r"""The unit of measurement used for the volume (liters, cubic feet, etc.)"""

    arrival_date: Annotated[Optional[str], pydantic.Field(alias="arrivalDate")] = None
    r"""The arrival date"""


class WeightTypedDict(TypedDict):
    weight_metric: NotRequired[float]
    r"""The total metric weight of all containers"""
    weight_uom_metric: NotRequired[str]
    r"""The unit of measurement used for the weight (kilos)"""
    weight_nonmetric: NotRequired[float]
    r"""The total nonmetric weight of all containers"""
    weight_uom_nonmetric: NotRequired[str]
    r"""The unit of measurement used for the weight (lbs)"""


class Weight(BaseModel):
    weight_metric: Annotated[Optional[float], pydantic.Field(alias="weightMetric")] = (
        None
    )
    r"""The total metric weight of all containers"""

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

    weight_nonmetric: Annotated[
        Optional[float], pydantic.Field(alias="weightNonmetric")
    ] = None
    r"""The total nonmetric weight of all containers"""

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


class PackagesTypedDict(TypedDict):
    number_of_packages: NotRequired[float]
    r"""The total number of packages"""
    package_type: NotRequired[str]
    r"""The package type"""


class Packages(BaseModel):
    number_of_packages: Annotated[
        Optional[float], pydantic.Field(alias="numberOfPackages")
    ] = None
    r"""The total number of packages"""

    package_type: Annotated[Optional[str], pydantic.Field(alias="packageType")] = None
    r"""The package type"""


class VolumeTypedDict(TypedDict):
    volume_metric: NotRequired[float]
    r"""The total metric volume of all containers"""
    volume_uom_metric: NotRequired[str]
    r"""The unit of measurement used for the volume (cubic meters)"""
    volume_nonmetric: NotRequired[float]
    r"""The total nonmetric volume of all containers"""
    volume_uom_nonmetric: NotRequired[str]
    r"""The unit of measurement used for the volume (liters, cubic feet, etc.)"""


class Volume(BaseModel):
    volume_metric: Annotated[Optional[float], pydantic.Field(alias="volumeMetric")] = (
        None
    )
    r"""The total metric volume of all containers"""

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

    volume_nonmetric: Annotated[
        Optional[float], pydantic.Field(alias="volumeNonmetric")
    ] = None
    r"""The total nonmetric volume of all containers"""

    volume_uom_nonmetric: Annotated[
        Optional[str], pydantic.Field(alias="volumeUomNonmetric")
    ] = None
    r"""The unit of measurement used for the volume (liters, cubic feet, etc.)"""


class AmountTypedDict(TypedDict):
    total: NotRequired[float]
    r"""The total price of the goods"""
    currency: NotRequired[str]
    r"""The currency of the arrival notice"""


class Amount(BaseModel):
    total: Optional[float] = None
    r"""The total price of the goods"""

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


class TermsTypedDict(TypedDict):
    prepaid: NotRequired[bool]
    r"""Indicates if the transport expenses are charged to the shipper"""
    collect: NotRequired[bool]
    r"""Indicates if the transport expenses are charged to the consignee"""


class Terms(BaseModel):
    prepaid: Optional[bool] = None
    r"""Indicates if the transport expenses are charged to the shipper"""

    collect: Optional[bool] = None
    r"""Indicates if the transport expenses are charged to the consignee"""


class ArrivalNoticeFieldsTypedDict(TypedDict):
    r"""Fields extracted from an arrival notice"""

    shipper: NotRequired[ArrivalNoticeFieldsShipperTypedDict]
    consignee: NotRequired[ArrivalNoticeFieldsConsigneeTypedDict]
    notify_party: NotRequired[NotifyPartyTypedDict]
    carrier: NotRequired[CarrierTypedDict]
    bill_to: NotRequired[ArrivalNoticeFieldsBillToTypedDict]
    r"""Information about the recipient of the invoice"""
    date_: NotRequired[date]
    r"""The date of the arrival notice"""
    arrival_date: NotRequired[date]
    r"""The arrival date of the shipment"""
    bol_number: NotRequired[str]
    r"""The number of the bill of lading representing the ownership of the goods"""
    house_bol_number: NotRequired[str]
    r"""The number of the bill of lading created by an Ocean Transport Intermediary (OTI)"""
    purchase_order_number: NotRequired[str]
    r"""The number of the purchase order"""
    vessel_name: NotRequired[str]
    r"""The name of the ship"""
    voyage_number: NotRequired[str]
    r"""The number of the voyage carrying the goods"""
    port_of_loading: NotRequired[str]
    r"""The port where the goods are to be loaded"""
    port_of_discharge: NotRequired[str]
    r"""The port where the goods are to be discharged"""
    terminal: NotRequired[str]
    r"""Terminal at the port of discharge where the ship arrived"""
    place_of_receipt: NotRequired[str]
    r"""The place of receipt of the goods"""
    place_of_delivery: NotRequired[str]
    r"""The place of delivery of the goods"""
    containers_not_in_table: NotRequired[List[ContainersNotInTableTypedDict]]
    containers: NotRequired[List[ContainersTypedDict]]
    weight: NotRequired[WeightTypedDict]
    packages: NotRequired[PackagesTypedDict]
    volume: NotRequired[VolumeTypedDict]
    amount: NotRequired[AmountTypedDict]
    terms: NotRequired[TermsTypedDict]


class ArrivalNoticeFields(BaseModel):
    r"""Fields extracted from an arrival notice"""

    shipper: Optional[ArrivalNoticeFieldsShipper] = None

    consignee: Optional[ArrivalNoticeFieldsConsignee] = None

    notify_party: Annotated[
        Optional[NotifyParty], pydantic.Field(alias="notifyParty")
    ] = None

    carrier: Optional[Carrier] = None

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

    date_: Annotated[Optional[date], pydantic.Field(alias="date")] = None
    r"""The date of the arrival notice"""

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

    bol_number: Annotated[Optional[str], pydantic.Field(alias="bolNumber")] = None
    r"""The number of the bill of lading representing the ownership of the goods"""

    house_bol_number: Annotated[
        Optional[str], pydantic.Field(alias="houseBolNumber")
    ] = None
    r"""The number of the bill of lading created by an Ocean Transport Intermediary (OTI)"""

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

    vessel_name: Annotated[Optional[str], pydantic.Field(alias="vesselName")] = None
    r"""The name of the ship"""

    voyage_number: Annotated[Optional[str], pydantic.Field(alias="voyageNumber")] = None
    r"""The number of the voyage carrying the goods"""

    port_of_loading: Annotated[Optional[str], pydantic.Field(alias="portOfLoading")] = (
        None
    )
    r"""The port where the goods are to be loaded"""

    port_of_discharge: Annotated[
        Optional[str], pydantic.Field(alias="portOfDischarge")
    ] = None
    r"""The port where the goods are to be discharged"""

    terminal: Optional[str] = None
    r"""Terminal at the port of discharge where the ship arrived"""

    place_of_receipt: Annotated[
        Optional[str], pydantic.Field(alias="placeOfReceipt")
    ] = None
    r"""The place of receipt of the goods"""

    place_of_delivery: Annotated[
        Optional[str], pydantic.Field(alias="placeOfDelivery")
    ] = None
    r"""The place of delivery of the goods"""

    containers_not_in_table: Annotated[
        Optional[List[ContainersNotInTable]],
        pydantic.Field(alias="containersNotInTable"),
    ] = None

    containers: Optional[List[Containers]] = None

    weight: Optional[Weight] = None

    packages: Optional[Packages] = None

    volume: Optional[Volume] = None

    amount: Optional[Amount] = None

    terms: Optional[Terms] = None
