"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .event import Event, EventTypedDict
from .shipment import Shipment, ShipmentTypedDict
from .statistics import Statistics, StatisticsTypedDict
from datetime import datetime
import pydantic
from ship24.types import BaseModel
from typing import Any, Dict, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


GetTrackingCourierCodeTypedDict = TypeAliasType(
    "GetTrackingCourierCodeTypedDict", Union[List[Any], str]
)


GetTrackingCourierCode = TypeAliasType("GetTrackingCourierCode", Union[List[Any], str])


class GetTrackingRequestTypedDict(TypedDict):
    tracking_number: NotRequired[str]
    r"""Tracking number of the shipment."""
    origin_country_code: NotRequired[str]
    r"""Sender country code - 📌 Recommended to improve tracking accuracy"""
    destination_country_code: NotRequired[str]
    r"""Recipient country code - 📌 Recommended to improve tracking accuracy"""
    destination_post_code: NotRequired[str]
    r"""Recipient Post code (or ZIP code) - 📌 Recommended to improve tracking accuracy"""
    shipping_date: NotRequired[datetime]
    r"""Date at which the shipment has been shipped  - 📌 Recommended to improve tracking accuracy: providing the shipping date helps us accurately identify the shipment and improves our ability to retrieve the correct data. However, an inaccurate shipping date could cause our system to exclude the right shipment. Therefore, please ensure the provided shipping date aligns closely with the actual shipment date, give or take a few days. [Format](http://docs.ship24.com/data-format#logistics-date-and-time)"""
    courier_code: NotRequired[GetTrackingCourierCodeTypedDict]
    r"""Code of the courier(s) handling the shipment (Up to 3 max) (see Couriers list section)  - 📌 Recommended to improve tracking accuracy"""


class GetTrackingRequest(BaseModel):
    tracking_number: Annotated[
        Optional[str], pydantic.Field(alias="trackingNumber")
    ] = None
    r"""Tracking number of the shipment."""

    origin_country_code: Annotated[
        Optional[str], pydantic.Field(alias="originCountryCode")
    ] = None
    r"""Sender country code - 📌 Recommended to improve tracking accuracy"""

    destination_country_code: Annotated[
        Optional[str], pydantic.Field(alias="destinationCountryCode")
    ] = None
    r"""Recipient country code - 📌 Recommended to improve tracking accuracy"""

    destination_post_code: Annotated[
        Optional[str], pydantic.Field(alias="destinationPostCode")
    ] = None
    r"""Recipient Post code (or ZIP code) - 📌 Recommended to improve tracking accuracy"""

    shipping_date: Annotated[
        Optional[datetime], pydantic.Field(alias="shippingDate")
    ] = None
    r"""Date at which the shipment has been shipped  - 📌 Recommended to improve tracking accuracy: providing the shipping date helps us accurately identify the shipment and improves our ability to retrieve the correct data. However, an inaccurate shipping date could cause our system to exclude the right shipment. Therefore, please ensure the provided shipping date aligns closely with the actual shipment date, give or take a few days. [Format](http://docs.ship24.com/data-format#logistics-date-and-time)"""

    courier_code: Annotated[
        Optional[GetTrackingCourierCode], pydantic.Field(alias="courierCode")
    ] = None
    r"""Code of the courier(s) handling the shipment (Up to 3 max) (see Couriers list section)  - 📌 Recommended to improve tracking accuracy"""


class GetTrackingTrackingTypedDict(TypedDict):
    shipment: NotRequired[ShipmentTypedDict]
    events: NotRequired[List[EventTypedDict]]
    statistics: NotRequired[StatisticsTypedDict]


class GetTrackingTracking(BaseModel):
    shipment: Optional[Shipment] = None

    events: Optional[List[Event]] = None

    statistics: Optional[Statistics] = None


class GetTrackingDataTypedDict(TypedDict):
    trackings: NotRequired[List[GetTrackingTrackingTypedDict]]


class GetTrackingData(BaseModel):
    trackings: Optional[List[GetTrackingTracking]] = None


class GetTrackingResponseBodyTypedDict(TypedDict):
    r"""Created"""

    data: NotRequired[GetTrackingDataTypedDict]


class GetTrackingResponseBody(BaseModel):
    r"""Created"""

    data: Optional[GetTrackingData] = None


class GetTrackingResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: GetTrackingResponseBodyTypedDict


class GetTrackingResponse(BaseModel):
    headers: Dict[str, List[str]]

    result: GetTrackingResponseBody
