"""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 Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class BillOfLadingFieldsTermsTypedDict(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"""
    third_party: NotRequired[bool]
    r"""Indicates if the transport expenses are charged to a third party"""


class BillOfLadingFieldsTerms(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"""

    third_party: Annotated[Optional[bool], pydantic.Field(alias="thirdParty")] = None
    r"""Indicates if the transport expenses are charged to a third party"""


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


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

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


class BillOfLadingFieldsCarrierTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The name of the carrier"""
    scac_code: NotRequired[str]
    r"""An SCAC (Standard Carrier Alpha Code) code used to identify transport companies"""


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

    scac_code: Annotated[Optional[str], pydantic.Field(alias="scacCode")] = None
    r"""An SCAC (Standard Carrier Alpha Code) code used to identify transport companies"""


class BillOfLadingFieldsConsigneeTypedDict(TypedDict):
    name: NotRequired[str]
    r"""The consignee's name"""
    customer_id: NotRequired[str]
    r"""The consignee's customer ID"""
    address: NotRequired[str]
    r"""The consignee's address"""


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

    customer_id: Annotated[Optional[str], pydantic.Field(alias="customerId")] = None
    r"""The consignee's customer ID"""

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


class BillOfLadingFieldsBillToTypedDict(TypedDict):
    r"""Information about the organization or business unit responsible for paying the freight fees"""

    name: NotRequired[str]
    r"""The name of the organization or business unit responsible for paying the freight fees"""
    address: NotRequired[str]
    r"""The address of the organization or business unit responsible for paying the freight fees"""


class BillOfLadingFieldsBillTo(BaseModel):
    r"""Information about the organization or business unit responsible for paying the freight fees"""

    name: Optional[str] = None
    r"""The name of the organization or business unit responsible for paying the freight fees"""

    address: Optional[str] = None
    r"""The address of the organization or business unit responsible for paying the freight fees"""


class BillOfLadingFieldsTypedDict(TypedDict):
    r"""Fields extracted from a bill of lading"""

    bol_number: NotRequired[str]
    r"""Bill of lading number"""
    bol_date: NotRequired[date]
    r"""The date on which the bill of lading was made"""
    po_number: NotRequired[str]
    r"""The purchase order number"""
    sales_order_number: NotRequired[str]
    r"""The sales order number"""
    shipment_id: NotRequired[str]
    r"""The shipment identifier"""
    shipment_date: NotRequired[date]
    r"""The date of the shipment"""
    pro_number: NotRequired[str]
    r"""A shipment identifier assigned by the carrier"""
    vehicle_number: NotRequired[str]
    r"""The number of the transport vehicle or carriage"""
    seal_number: NotRequired[str]
    r"""The seal number"""
    terms: NotRequired[BillOfLadingFieldsTermsTypedDict]
    nmfc_code: NotRequired[str]
    r"""National Motor Freight Classification shipment identifier"""
    class_: NotRequired[str]
    r"""National Motor Freight Classification shipment class"""
    port_of_loading: NotRequired[str]
    r"""The origin of the shipment"""
    port_of_discharge: NotRequired[str]
    r"""The destination of the shipment"""
    special_instructions: NotRequired[str]
    r"""Special handling instructions for the carrier regarding the shipment"""
    number_of_packages: NotRequired[float]
    r"""The total number of packages"""
    package_type: NotRequired[str]
    r"""The package type"""
    total_weight_nonmetric: NotRequired[float]
    r"""The total weight of the shipment in non-metric units of measurement"""
    total_weight_uom_nonmetric: NotRequired[str]
    r"""The non-metric unit of measurement used for the total weight"""
    total_weight_metric: NotRequired[float]
    r"""The total weight of the shipment in metric units of measurement"""
    total_weight_uom_metric: NotRequired[str]
    r"""The metric unit of measurement used for the total weight"""
    hazardous_material: NotRequired[bool]
    r"""Indicates whether the shipment contains any items classified as hazardous"""
    shipper: NotRequired[BillOfLadingFieldsShipperTypedDict]
    carrier: NotRequired[BillOfLadingFieldsCarrierTypedDict]
    consignee: NotRequired[BillOfLadingFieldsConsigneeTypedDict]
    bill_to: NotRequired[BillOfLadingFieldsBillToTypedDict]
    r"""Information about the organization or business unit responsible for paying the freight fees"""


class BillOfLadingFields(BaseModel):
    r"""Fields extracted from a bill of lading"""

    bol_number: Annotated[Optional[str], pydantic.Field(alias="bolNumber")] = None
    r"""Bill of lading number"""

    bol_date: Annotated[Optional[date], pydantic.Field(alias="bolDate")] = None
    r"""The date on which the bill of lading was made"""

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

    sales_order_number: Annotated[
        Optional[str], pydantic.Field(alias="salesOrderNumber")
    ] = None
    r"""The sales order number"""

    shipment_id: Annotated[Optional[str], pydantic.Field(alias="shipmentId")] = None
    r"""The shipment identifier"""

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

    pro_number: Annotated[Optional[str], pydantic.Field(alias="proNumber")] = None
    r"""A shipment identifier assigned by the carrier"""

    vehicle_number: Annotated[Optional[str], pydantic.Field(alias="vehicleNumber")] = (
        None
    )
    r"""The number of the transport vehicle or carriage"""

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

    terms: Optional[BillOfLadingFieldsTerms] = None

    nmfc_code: Annotated[Optional[str], pydantic.Field(alias="nmfcCode")] = None
    r"""National Motor Freight Classification shipment identifier"""

    class_: Annotated[Optional[str], pydantic.Field(alias="class")] = None
    r"""National Motor Freight Classification shipment class"""

    port_of_loading: Annotated[Optional[str], pydantic.Field(alias="portOfLoading")] = (
        None
    )
    r"""The origin of the shipment"""

    port_of_discharge: Annotated[
        Optional[str], pydantic.Field(alias="portOfDischarge")
    ] = None
    r"""The destination of the shipment"""

    special_instructions: Annotated[
        Optional[str], pydantic.Field(alias="specialInstructions")
    ] = None
    r"""Special handling instructions for the carrier regarding the shipment"""

    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"""

    total_weight_nonmetric: Annotated[
        Optional[float], pydantic.Field(alias="totalWeightNonmetric")
    ] = None
    r"""The total weight of the shipment in non-metric units of measurement"""

    total_weight_uom_nonmetric: Annotated[
        Optional[str], pydantic.Field(alias="totalWeightUomNonmetric")
    ] = None
    r"""The non-metric unit of measurement used for the total weight"""

    total_weight_metric: Annotated[
        Optional[float], pydantic.Field(alias="totalWeightMetric")
    ] = None
    r"""The total weight of the shipment in metric units of measurement"""

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

    hazardous_material: Annotated[
        Optional[bool], pydantic.Field(alias="hazardousMaterial")
    ] = None
    r"""Indicates whether the shipment contains any items classified as hazardous"""

    shipper: Optional[BillOfLadingFieldsShipper] = None

    carrier: Optional[BillOfLadingFieldsCarrier] = None

    consignee: Optional[BillOfLadingFieldsConsignee] = None

    bill_to: Annotated[
        Optional[BillOfLadingFieldsBillTo], pydantic.Field(alias="billTo")
    ] = None
    r"""Information about the organization or business unit responsible for paying the freight fees"""
