"""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 ShipperTypedDict(TypedDict):
    account_number: NotRequired[str]
    r"""The shipper's account number"""
    name: NotRequired[str]
    r"""The shipper's name"""
    address: NotRequired[str]
    r"""The shipper's address"""
    country: NotRequired[str]
    r"""The shipper's country"""
    city: NotRequired[str]
    r"""The shipper's city"""
    state_or_province: NotRequired[str]
    r"""The shipper's state or province"""
    postal_code: NotRequired[str]
    r"""The shipper's postal code"""
    street: NotRequired[str]
    r"""The shipper's street address"""
    tax_id: NotRequired[str]
    r"""The shipper's international tax identification number"""


class Shipper(BaseModel):
    account_number: Annotated[Optional[str], pydantic.Field(alias="accountNumber")] = (
        None
    )
    r"""The shipper's account number"""

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

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

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

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

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

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

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

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The shipper's international tax identification number"""


class ConsigneeTypedDict(TypedDict):
    account_number: NotRequired[str]
    r"""The consignee's account number"""
    name: NotRequired[str]
    r"""The consignee's name"""
    address: NotRequired[str]
    r"""The consignee's address"""
    country: NotRequired[str]
    r"""The consignee's country"""
    state_or_province: NotRequired[str]
    r"""The consignee's state or province"""
    city: NotRequired[str]
    r"""The consignee's city"""
    postal_code: NotRequired[str]
    r"""The consignee's postal code"""
    street: NotRequired[str]
    r"""The consignee's street address"""
    tax_id: NotRequired[str]
    r"""The consignee's international tax identification number"""


class Consignee(BaseModel):
    account_number: Annotated[Optional[str], pydantic.Field(alias="accountNumber")] = (
        None
    )
    r"""The consignee's account number"""

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

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

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

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

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

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

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

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The consignee's international tax identification number"""


class CarriersAgentTypedDict(TypedDict):
    account_number: NotRequired[str]
    r"""The carrier's account number"""
    iata_code: NotRequired[str]
    r"""The carrier's identification number"""
    name: NotRequired[str]
    r"""The carrier's name"""
    address: NotRequired[str]
    r"""The carrier's address"""
    country: NotRequired[str]
    r"""The carrier's country"""
    state_or_province: NotRequired[str]
    r"""The carrier's state or province"""
    city: NotRequired[str]
    r"""The carrier's city"""
    postal_code: NotRequired[str]
    r"""The carrier's postal code"""
    street: NotRequired[str]
    r"""The carrier's street address"""
    tax_id: NotRequired[str]
    r"""The carrier's international tax identification number"""


class CarriersAgent(BaseModel):
    account_number: Annotated[Optional[str], pydantic.Field(alias="accountNumber")] = (
        None
    )
    r"""The carrier's account number"""

    iata_code: Annotated[Optional[str], pydantic.Field(alias="iataCode")] = None
    r"""The carrier's identification number"""

    name: Optional[str] = None
    r"""The carrier's name"""

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

    country: Optional[str] = None
    r"""The carrier's country"""

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

    city: Optional[str] = None
    r"""The carrier's city"""

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

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

    tax_id: Annotated[Optional[str], pydantic.Field(alias="taxId")] = None
    r"""The carrier's international tax identification number"""


class AirlineTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the airline engaged to carry the goods"""
    address: NotRequired[str]
    r"""The airline's address"""
    country: NotRequired[str]
    r"""The airline's country"""
    state_or_province: NotRequired[str]
    r"""The airline's state or province"""
    city: NotRequired[str]
    r"""The airline's city"""
    postal_code: NotRequired[str]
    r"""The airline's postal code"""
    street: NotRequired[str]
    r"""The airline's street address"""


class Airline(BaseModel):
    name: Optional[str] = None
    r"""The name of the airline engaged to carry the goods"""

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

    country: Optional[str] = None
    r"""The airline's country"""

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

    city: Optional[str] = None
    r"""The airline's city"""

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

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


class AirWaybillNumberTypedDict(TypedDict):
    mawb_number: NotRequired[str]
    r"""The master air waybill number"""
    hawb_number: NotRequired[str]
    r"""The house air waybill number"""


class AirWaybillNumber(BaseModel):
    mawb_number: Annotated[Optional[str], pydantic.Field(alias="mawbNumber")] = None
    r"""The master air waybill number"""

    hawb_number: Annotated[Optional[str], pydantic.Field(alias="hawbNumber")] = None
    r"""The house air waybill number"""


class AirportOfDepartureTypedDict(TypedDict):
    airport_code: NotRequired[str]
    r"""The airport code of departure"""
    city: NotRequired[str]
    r"""The city of departure"""
    country: NotRequired[str]
    r"""The country of departure"""
    name: NotRequired[str]
    r"""The name of the departure airport"""


class AirportOfDeparture(BaseModel):
    airport_code: Annotated[Optional[str], pydantic.Field(alias="airportCode")] = None
    r"""The airport code of departure"""

    city: Optional[str] = None
    r"""The city of departure"""

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

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


class AirportOfDestinationTypedDict(TypedDict):
    airport_code: NotRequired[str]
    r"""The airport code of destination"""
    city: NotRequired[str]
    r"""The city of destination"""
    country: NotRequired[str]
    r"""The country of destination"""
    name: NotRequired[str]
    r"""The name of the destination airport"""


class AirportOfDestination(BaseModel):
    airport_code: Annotated[Optional[str], pydantic.Field(alias="airportCode")] = None
    r"""The airport code of destination"""

    city: Optional[str] = None
    r"""The city of destination"""

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

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


class FlightAndDateTypedDict(TypedDict):
    flight: NotRequired[str]
    r"""The number of the flight carrying the goods"""
    flight_date: NotRequired[date]
    r"""The date of the flight carrying the goods"""


class FlightAndDate(BaseModel):
    flight: Optional[str] = None
    r"""The number of the flight carrying the goods"""

    flight_date: Annotated[Optional[date], pydantic.Field(alias="flightDate")] = None
    r"""The date of the flight carrying the goods"""


class AirWaybillFieldsLineItemsTypedDict(TypedDict):
    quantity: NotRequired[float]
    r"""The number of pieces"""
    quantity_uom: NotRequired[str]
    r"""The unit of measurement used for the goods"""
    gross_weight_kg: NotRequired[float]
    r"""The weight of the goods in kilograms"""
    gross_weight_lb: NotRequired[float]
    r"""The weight of the goods in pounds"""
    rate_class: NotRequired[str]
    r"""The rate class of the goods"""
    commodity_item_no: NotRequired[str]
    r"""The code of the goods"""
    chargeable_weight: NotRequired[float]
    r"""The chargeable weight of the goods"""
    rate_or_charge: NotRequired[float]
    r"""Additional charges"""
    total: NotRequired[float]
    r"""The total amount of charges"""
    length: NotRequired[float]
    r"""The length of the package"""
    width: NotRequired[float]
    r"""The width of the package"""
    height: NotRequired[float]
    r"""The height of the package"""
    dimensions_uom: NotRequired[str]
    r"""The unit of measurement used for the dimensions"""
    description: NotRequired[str]
    r"""A description of the goods"""


class AirWaybillFieldsLineItems(BaseModel):
    quantity: Optional[float] = None
    r"""The number of pieces"""

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

    gross_weight_kg: Annotated[
        Optional[float], pydantic.Field(alias="grossWeightKg")
    ] = None
    r"""The weight of the goods in kilograms"""

    gross_weight_lb: Annotated[
        Optional[float], pydantic.Field(alias="grossWeightLb")
    ] = None
    r"""The weight of the goods in pounds"""

    rate_class: Annotated[Optional[str], pydantic.Field(alias="rateClass")] = None
    r"""The rate class of the goods"""

    commodity_item_no: Annotated[
        Optional[str], pydantic.Field(alias="commodityItemNo")
    ] = None
    r"""The code of the goods"""

    chargeable_weight: Annotated[
        Optional[float], pydantic.Field(alias="chargeableWeight")
    ] = None
    r"""The chargeable weight of the goods"""

    rate_or_charge: Annotated[Optional[float], pydantic.Field(alias="rateOrCharge")] = (
        None
    )
    r"""Additional charges"""

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

    length: Optional[float] = None
    r"""The length of the package"""

    width: Optional[float] = None
    r"""The width of the package"""

    height: Optional[float] = None
    r"""The height of the package"""

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

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


class DimensionsTypedDict(TypedDict):
    length: NotRequired[float]
    r"""The length of the package"""
    width: NotRequired[float]
    r"""The width of the package"""
    height: NotRequired[float]
    r"""The height of the package"""
    dimensions_uom: NotRequired[str]
    r"""The unit of measurement used for the dimensions"""


class Dimensions(BaseModel):
    length: Optional[float] = None
    r"""The length of the package"""

    width: Optional[float] = None
    r"""The width of the package"""

    height: Optional[float] = None
    r"""The height of the package"""

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


class TotalsTypedDict(TypedDict):
    total_quantity: NotRequired[float]
    r"""The total number of pieces"""
    total_quantity_uom: NotRequired[str]
    r"""The unit of measurement used for the goods"""
    total_weight: NotRequired[float]
    r"""The total weight of the goods"""
    total_weight_uom: NotRequired[str]
    r"""The unit of measurement used for the weight"""
    total_chargeable_weight: NotRequired[float]
    r"""The total chargeable weight of the goods"""
    rate_or_charge: NotRequired[float]
    r"""Additional charges"""
    total: NotRequired[float]
    r"""The total amount of charges"""
    volume: NotRequired[float]
    r"""The volume of the goods"""
    volume_uom: NotRequired[str]
    r"""The unit of measurement used for the volume"""


class Totals(BaseModel):
    total_quantity: Annotated[
        Optional[float], pydantic.Field(alias="totalQuantity")
    ] = None
    r"""The total number of pieces"""

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

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

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

    total_chargeable_weight: Annotated[
        Optional[float], pydantic.Field(alias="totalChargeableWeight")
    ] = None
    r"""The total chargeable weight of the goods"""

    rate_or_charge: Annotated[Optional[float], pydantic.Field(alias="rateOrCharge")] = (
        None
    )
    r"""Additional charges"""

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

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

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


class ChargesTypedDict(TypedDict):
    weight_charges: NotRequired[float]
    r"""The sum indicated in the air waybill exclusive of any additional charges"""
    valuation_charges: NotRequired[float]
    r"""Additional charges imposed on the shipper if the declared value of the cargo exceeds the carrier's insurance coverage"""
    tax: NotRequired[float]
    r"""The taxes as stated in the air waybill"""
    pickup_charge: NotRequired[float]
    r"""The pickup charge for the goods"""
    freight_advance: NotRequired[float]
    r"""The amount paid as advance freight"""
    total_prepaid: NotRequired[float]
    r"""The prepaid amount, including all the additional charges"""
    total_collect: NotRequired[float]
    r"""The amount payable upon receipt"""
    other_charges: NotRequired[List[float]]
    total_other_charges: NotRequired[float]
    r"""The total amount of additional charges"""


class Charges(BaseModel):
    weight_charges: Annotated[
        Optional[float], pydantic.Field(alias="weightCharges")
    ] = None
    r"""The sum indicated in the air waybill exclusive of any additional charges"""

    valuation_charges: Annotated[
        Optional[float], pydantic.Field(alias="valuationCharges")
    ] = None
    r"""Additional charges imposed on the shipper if the declared value of the cargo exceeds the carrier's insurance coverage"""

    tax: Optional[float] = None
    r"""The taxes as stated in the air waybill"""

    pickup_charge: Annotated[Optional[float], pydantic.Field(alias="pickupCharge")] = (
        None
    )
    r"""The pickup charge for the goods"""

    freight_advance: Annotated[
        Optional[float], pydantic.Field(alias="freightAdvance")
    ] = None
    r"""The amount paid as advance freight"""

    total_prepaid: Annotated[Optional[float], pydantic.Field(alias="totalPrepaid")] = (
        None
    )
    r"""The prepaid amount, including all the additional charges"""

    total_collect: Annotated[Optional[float], pydantic.Field(alias="totalCollect")] = (
        None
    )
    r"""The amount payable upon receipt"""

    other_charges: Annotated[
        Optional[List[float]], pydantic.Field(alias="otherCharges")
    ] = None

    total_other_charges: Annotated[
        Optional[float], pydantic.Field(alias="totalOtherCharges")
    ] = None
    r"""The total amount of additional charges"""


class AirWaybillFieldsTypedDict(TypedDict):
    r"""Fields extracted from an air waybill"""

    description: NotRequired[str]
    r"""A description of the goods"""
    commodity_item_no: NotRequired[str]
    r"""The code of the goods"""
    shipper: NotRequired[ShipperTypedDict]
    consignee: NotRequired[ConsigneeTypedDict]
    carriers_agent: NotRequired[CarriersAgentTypedDict]
    airline: NotRequired[AirlineTypedDict]
    air_waybill_number: NotRequired[AirWaybillNumberTypedDict]
    air_waybill_date: NotRequired[date]
    r"""The date of the air waybill"""
    airport_of_departure: NotRequired[AirportOfDepartureTypedDict]
    airport_of_destination: NotRequired[AirportOfDestinationTypedDict]
    flight_and_date: NotRequired[List[FlightAndDateTypedDict]]
    declared_value_for_carriage: NotRequired[float]
    r"""The value of the cargo declared to the carrier"""
    declared_value_for_customs: NotRequired[float]
    r"""The value of the cargo declared to the customs"""
    amount_of_insurance: NotRequired[float]
    r"""The amount of the insurance coverage on the goods"""
    currency: NotRequired[str]
    r"""The currency of the air waybill"""
    line_items: NotRequired[List[AirWaybillFieldsLineItemsTypedDict]]
    dimensions: NotRequired[List[DimensionsTypedDict]]
    totals: NotRequired[TotalsTypedDict]
    charges: NotRequired[ChargesTypedDict]


class AirWaybillFields(BaseModel):
    r"""Fields extracted from an air waybill"""

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

    commodity_item_no: Annotated[
        Optional[str], pydantic.Field(alias="commodityItemNo")
    ] = None
    r"""The code of the goods"""

    shipper: Optional[Shipper] = None

    consignee: Optional[Consignee] = None

    carriers_agent: Annotated[
        Optional[CarriersAgent], pydantic.Field(alias="carriersAgent")
    ] = None

    airline: Optional[Airline] = None

    air_waybill_number: Annotated[
        Optional[AirWaybillNumber], pydantic.Field(alias="airWaybillNumber")
    ] = None

    air_waybill_date: Annotated[
        Optional[date], pydantic.Field(alias="airWaybillDate")
    ] = None
    r"""The date of the air waybill"""

    airport_of_departure: Annotated[
        Optional[AirportOfDeparture], pydantic.Field(alias="airportOfDeparture")
    ] = None

    airport_of_destination: Annotated[
        Optional[AirportOfDestination], pydantic.Field(alias="airportOfDestination")
    ] = None

    flight_and_date: Annotated[
        Optional[List[FlightAndDate]], pydantic.Field(alias="flightAndDate")
    ] = None

    declared_value_for_carriage: Annotated[
        Optional[float], pydantic.Field(alias="declaredValueForCarriage")
    ] = None
    r"""The value of the cargo declared to the carrier"""

    declared_value_for_customs: Annotated[
        Optional[float], pydantic.Field(alias="declaredValueForCustoms")
    ] = None
    r"""The value of the cargo declared to the customs"""

    amount_of_insurance: Annotated[
        Optional[float], pydantic.Field(alias="amountOfInsurance")
    ] = None
    r"""The amount of the insurance coverage on the goods"""

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

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

    dimensions: Optional[List[Dimensions]] = None

    totals: Optional[Totals] = None

    charges: Optional[Charges] = None
