"""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 .tracker import Tracker, TrackerTypedDict
from enum import Enum
import pydantic
from ship24.types import BaseModel
from ship24.utils import FieldMetadata, PathParamMetadata, QueryParamMetadata
from typing import Dict, List, Optional
from typing_extensions import Annotated, NotRequired, TypedDict


class GetTrackingResultsOfTrackerByTrackerIDSearchBy(str, Enum):
    r"""Parameter allowing to search either by `trackerId`or `clientTrackerId`. Default behavior is by `trackerId`."""

    TRACKER_ID = "trackerId"
    CLIENT_TRACKER_ID = "clientTrackerId"


class GetTrackingResultsOfTrackerByTrackerIDRequestTypedDict(TypedDict):
    tracker_id: str
    r"""**Required** Id of the tracker, provided by Ship24 at creation. `clientTrackerId` can also be used in this field by employing the `searchBy` parameter."""
    search_by: NotRequired[GetTrackingResultsOfTrackerByTrackerIDSearchBy]
    r"""Parameter allowing to search either by `trackerId`or `clientTrackerId`. Default behavior is by `trackerId`."""


class GetTrackingResultsOfTrackerByTrackerIDRequest(BaseModel):
    tracker_id: Annotated[
        str,
        pydantic.Field(alias="trackerId"),
        FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
    ]
    r"""**Required** Id of the tracker, provided by Ship24 at creation. `clientTrackerId` can also be used in this field by employing the `searchBy` parameter."""

    search_by: Annotated[
        Optional[GetTrackingResultsOfTrackerByTrackerIDSearchBy],
        pydantic.Field(alias="searchBy"),
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Parameter allowing to search either by `trackerId`or `clientTrackerId`. Default behavior is by `trackerId`."""


class GetTrackingResultsOfTrackerByTrackerIDTrackingTypedDict(TypedDict):
    tracker: NotRequired[TrackerTypedDict]
    shipment: NotRequired[ShipmentTypedDict]
    events: NotRequired[List[EventTypedDict]]
    statistics: NotRequired[StatisticsTypedDict]


class GetTrackingResultsOfTrackerByTrackerIDTracking(BaseModel):
    tracker: Optional[Tracker] = None

    shipment: Optional[Shipment] = None

    events: Optional[List[Event]] = None

    statistics: Optional[Statistics] = None


class GetTrackingResultsOfTrackerByTrackerIDDataTypedDict(TypedDict):
    trackings: NotRequired[
        List[GetTrackingResultsOfTrackerByTrackerIDTrackingTypedDict]
    ]


class GetTrackingResultsOfTrackerByTrackerIDData(BaseModel):
    trackings: Optional[List[GetTrackingResultsOfTrackerByTrackerIDTracking]] = None


class GetTrackingResultsOfTrackerByTrackerIDResponseBodyTypedDict(TypedDict):
    r"""OK"""

    data: NotRequired[GetTrackingResultsOfTrackerByTrackerIDDataTypedDict]


class GetTrackingResultsOfTrackerByTrackerIDResponseBody(BaseModel):
    r"""OK"""

    data: Optional[GetTrackingResultsOfTrackerByTrackerIDData] = None


class GetTrackingResultsOfTrackerByTrackerIDResponseTypedDict(TypedDict):
    headers: Dict[str, List[str]]
    result: GetTrackingResultsOfTrackerByTrackerIDResponseBodyTypedDict


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

    result: GetTrackingResultsOfTrackerByTrackerIDResponseBody
