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

from __future__ import annotations
from datetime import datetime
import pydantic
from ship24.types import BaseModel
from typing import Any, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


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


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


class TrackerCreateRequestRecipientTypedDict(TypedDict):
    email: NotRequired[str]
    r"""Recipient email, used for optional email notifications."""
    name: NotRequired[str]
    r"""Recipient name, used for optional email notifications."""


class TrackerCreateRequestRecipient(BaseModel):
    email: Optional[str] = None
    r"""Recipient email, used for optional email notifications."""

    name: Optional[str] = None
    r"""Recipient name, used for optional email notifications."""


class SettingsTypedDict(TypedDict):
    restrict_tracking_to_courier_code: NotRequired[bool]
    r"""If set to `true`, the tracker will only track the courier(s) specified in the `courierCode` field, if any. Otherwise, Ship24 may extend the tracking to other providers in case the shipment is handled by additional couriers."""


class Settings(BaseModel):
    restrict_tracking_to_courier_code: Annotated[
        Optional[bool], pydantic.Field(alias="restrictTrackingToCourierCode")
    ] = None
    r"""If set to `true`, the tracker will only track the courier(s) specified in the `courierCode` field, if any. Otherwise, Ship24 may extend the tracking to other providers in case the shipment is handled by additional couriers."""


class TrackerCreateRequestTypedDict(TypedDict):
    tracking_number: str
    r"""Tracking number of the shipment."""
    shipment_reference: NotRequired[str]
    r"""Your reference for this shipment. Will be provided in our webhooks or API responses for this tracker."""
    client_tracker_id: NotRequired[str]
    r"""Your unique identifier for this shipment. Will be provided in our webhooks or API responses for this tracker."""
    origin_country_code: NotRequired[str]
    r"""Sender country code."""
    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[TrackerCreateRequestCourierCodeTypedDict]
    r"""Code of the courier(s) handling the shipment (Up to 3 max) (see Couriers list section)  - 📌 Recommended to improve tracking accuracy"""
    courier_name: NotRequired[str]
    r"""Courier name and/or service."""
    tracking_url: NotRequired[str]
    r"""Tracking URL of the courier."""
    order_number: NotRequired[str]
    r"""Order number in case of an eCommerce order."""
    title: NotRequired[str]
    r"""Title for this shipment, visible on the Tracking Dashboard."""
    recipient: NotRequired[TrackerCreateRequestRecipientTypedDict]
    settings: NotRequired[SettingsTypedDict]


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

    shipment_reference: Annotated[
        Optional[str], pydantic.Field(alias="shipmentReference")
    ] = None
    r"""Your reference for this shipment. Will be provided in our webhooks or API responses for this tracker."""

    client_tracker_id: Annotated[
        Optional[str], pydantic.Field(alias="clientTrackerId")
    ] = None
    r"""Your unique identifier for this shipment. Will be provided in our webhooks or API responses for this tracker."""

    origin_country_code: Annotated[
        Optional[str], pydantic.Field(alias="originCountryCode")
    ] = None
    r"""Sender country code."""

    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[TrackerCreateRequestCourierCode], 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"""

    courier_name: Annotated[Optional[str], pydantic.Field(alias="courierName")] = None
    r"""Courier name and/or service."""

    tracking_url: Annotated[Optional[str], pydantic.Field(alias="trackingUrl")] = None
    r"""Tracking URL of the courier."""

    order_number: Annotated[Optional[str], pydantic.Field(alias="orderNumber")] = None
    r"""Order number in case of an eCommerce order."""

    title: Optional[str] = None
    r"""Title for this shipment, visible on the Tracking Dashboard."""

    recipient: Optional[TrackerCreateRequestRecipient] = None

    settings: Optional[Settings] = None
