"""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 ExporterTypedDict(TypedDict):
    r"""Information about the exporter/manufacturer of the goods"""

    name: NotRequired[str]
    r"""The name of the exporter/manufacturer of the goods"""
    address: NotRequired[str]
    r"""The address of the exporter/manufacturer of the goods"""


class Exporter(BaseModel):
    r"""Information about the exporter/manufacturer of the goods"""

    name: Optional[str] = None
    r"""The name of the exporter/manufacturer of the goods"""

    address: Optional[str] = None
    r"""The address of the exporter/manufacturer of the goods"""


class CertificateOfOriginFieldsConsigneeTypedDict(TypedDict):
    r"""Information about the importer/consignee of the goods"""

    name: NotRequired[str]
    r"""The name of the importer/consignee of the goods"""
    address: NotRequired[str]
    r"""The address of the importer/consignee of the goods"""


class CertificateOfOriginFieldsConsignee(BaseModel):
    r"""Information about the importer/consignee of the goods"""

    name: Optional[str] = None
    r"""The name of the importer/consignee of the goods"""

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


class MeansOfTransportAndRouteTypedDict(TypedDict):
    city_of_origin: NotRequired[str]
    r"""The city of origin"""
    country_of_origin: NotRequired[str]
    r"""The country of origin"""
    city_of_destination: NotRequired[str]
    r"""The city of destination"""
    country_of_destination: NotRequired[str]
    r"""The country of destination"""
    means_of_transport: NotRequired[str]
    r"""The means of transport used to ship the goods"""
    departure_date: NotRequired[date]
    r"""The departure date of the transport"""


class MeansOfTransportAndRoute(BaseModel):
    city_of_origin: Annotated[Optional[str], pydantic.Field(alias="cityOfOrigin")] = (
        None
    )
    r"""The city of origin"""

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

    city_of_destination: Annotated[
        Optional[str], pydantic.Field(alias="cityOfDestination")
    ] = None
    r"""The city of destination"""

    country_of_destination: Annotated[
        Optional[str], pydantic.Field(alias="countryOfDestination")
    ] = None
    r"""The country of destination"""

    means_of_transport: Annotated[
        Optional[str], pydantic.Field(alias="meansOfTransport")
    ] = None
    r"""The means of transport used to ship the goods"""

    departure_date: Annotated[Optional[date], pydantic.Field(alias="departureDate")] = (
        None
    )
    r"""The departure date of the transport"""


class InvoiceNumbersTypedDict(TypedDict):
    invoice_number: NotRequired[str]
    r"""The invoice number"""
    invoice_date: NotRequired[date]
    r"""The invoice date"""


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

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


class CertificateOfOriginFieldsLineItemsTypedDict(TypedDict):
    position: NotRequired[float]
    r"""The line item position number"""
    numbers_and_kind_of_packages: NotRequired[str]
    r"""A general description of the goods and their packaging"""
    description: NotRequired[str]
    r"""A general description of the goods and their packaging"""
    hs_code: NotRequired[str]
    r"""The Harmonized System (HS) code"""
    origin_criterion: NotRequired[str]
    r"""The Origin Criterion (WO, PE, or PSR)"""
    preference_criterion: NotRequired[str]
    r"""The Preference Criterion (A, B, C, D, E, or F)"""
    country_of_origin: NotRequired[str]
    r"""The country of origin of the goods"""
    quantity: NotRequired[float]
    r"""The number of units of goods"""
    uom: NotRequired[str]
    r"""The unit of measurement used for the goods"""
    net_weight: NotRequired[float]
    r"""The net weight of the goods"""
    gross_weight: NotRequired[float]
    r"""The gross weight of the goods"""
    weight_uom: NotRequired[str]
    r"""The unit of measurement for the weight of the goods"""


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

    numbers_and_kind_of_packages: Annotated[
        Optional[str], pydantic.Field(alias="numbersAndKindOfPackages")
    ] = None
    r"""A general description of the goods and their packaging"""

    description: Optional[str] = None
    r"""A general description of the goods and their packaging"""

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

    origin_criterion: Annotated[
        Optional[str], pydantic.Field(alias="originCriterion")
    ] = None
    r"""The Origin Criterion (WO, PE, or PSR)"""

    preference_criterion: Annotated[
        Optional[str], pydantic.Field(alias="preferenceCriterion")
    ] = None
    r"""The Preference Criterion (A, B, C, D, E, or F)"""

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

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

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

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

    gross_weight: Annotated[Optional[float], pydantic.Field(alias="grossWeight")] = None
    r"""The gross weight of the goods"""

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


class CertificateOfOriginFieldsTypedDict(TypedDict):
    r"""Fields extracted from a certificate of origin"""

    certificate_number: NotRequired[str]
    r"""The certificate number"""
    serial_number: NotRequired[str]
    r"""The certificate serial number"""
    country_of_issue: NotRequired[str]
    r"""The certificate country of issue"""
    exporter: NotRequired[ExporterTypedDict]
    r"""Information about the exporter/manufacturer of the goods"""
    consignee: NotRequired[CertificateOfOriginFieldsConsigneeTypedDict]
    r"""Information about the importer/consignee of the goods"""
    means_of_transport_and_route: NotRequired[MeansOfTransportAndRouteTypedDict]
    invoice_numbers: NotRequired[List[InvoiceNumbersTypedDict]]
    marks_and_numbers_of_packages: NotRequired[str]
    r"""Package marking and numbering"""
    line_items: NotRequired[List[CertificateOfOriginFieldsLineItemsTypedDict]]
    weight: NotRequired[float]
    r"""The total weight of the goods"""
    weight_uom: NotRequired[str]
    r"""The unit of measurement for the total weight of the goods"""


class CertificateOfOriginFields(BaseModel):
    r"""Fields extracted from a certificate of origin"""

    certificate_number: Annotated[
        Optional[str], pydantic.Field(alias="certificateNumber")
    ] = None
    r"""The certificate number"""

    serial_number: Annotated[Optional[str], pydantic.Field(alias="serialNumber")] = None
    r"""The certificate serial number"""

    country_of_issue: Annotated[
        Optional[str], pydantic.Field(alias="countryOfIssue")
    ] = None
    r"""The certificate country of issue"""

    exporter: Optional[Exporter] = None
    r"""Information about the exporter/manufacturer of the goods"""

    consignee: Optional[CertificateOfOriginFieldsConsignee] = None
    r"""Information about the importer/consignee of the goods"""

    means_of_transport_and_route: Annotated[
        Optional[MeansOfTransportAndRoute],
        pydantic.Field(alias="meansOfTransportAndRoute"),
    ] = None

    invoice_numbers: Annotated[
        Optional[List[InvoiceNumbers]], pydantic.Field(alias="invoiceNumbers")
    ] = None

    marks_and_numbers_of_packages: Annotated[
        Optional[str], pydantic.Field(alias="marksAndNumbersOfPackages")
    ] = None
    r"""Package marking and numbering"""

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

    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 for the total weight of the goods"""
