# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .goa_address_tiny_response_response_body import GoaAddressTinyResponseResponseBody
from .goa_document_tiny_response_response_body import GoaDocumentTinyResponseResponseBody
from .goa_form_tiny_response_response_body import GoaFormTinyResponseResponseBody
from .goa_issue_tiny_response_response_body import GoaIssueTinyResponseResponseBody
from .live_sharing_link_response_object_response_body import LiveSharingLinkResponseObjectResponseBody
from .routes_single_use_address_object_response_body import RoutesSingleUseAddressObjectResponseBody
from .routes_stop_response_object_response_body_state import RoutesStopResponseObjectResponseBodyState


class RoutesStopResponseObjectResponseBody(UniversalBaseModel):
    actual_arrival_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="actualArrivalTime"),
        pydantic.Field(
            alias="actualArrivalTime",
            description="Actual arrival time, if it exists, for the route stop in RFC 3339 format.",
        ),
    ] = None
    actual_departure_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="actualDepartureTime"),
        pydantic.Field(
            alias="actualDepartureTime",
            description="Actual departure time, if it exists, for the route stop in RFC 3339 format.",
        ),
    ] = None
    actual_distance_meters: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="actualDistanceMeters"),
        pydantic.Field(
            alias="actualDistanceMeters",
            description="Actual GPS-measured distance traveled from the previous stop's departure to this stop's arrival, in meters. Null for the first stop, skipped stops, or if GPS data is unavailable.",
        ),
    ] = None
    address: typing.Optional[GoaAddressTinyResponseResponseBody] = None
    documents: typing.Optional[typing.List[GoaDocumentTinyResponseResponseBody]] = pydantic.Field(default=None)
    """
    List of documents associated with the stop.
    """

    en_route_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="enRouteTime"),
        pydantic.Field(alias="enRouteTime", description="The time the stop became en-route, in RFC 3339 format."),
    ] = None
    eta: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Estimated time of arrival, if this stop is currently en-route, in RFC 3339 format.
    """

    external_ids: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, str]],
        FieldMetadata(alias="externalIds"),
        pydantic.Field(alias="externalIds", description="A map of external ids"),
    ] = None
    forms: typing.Optional[typing.List[GoaFormTinyResponseResponseBody]] = pydantic.Field(default=None)
    """
    List of forms associated with the stop.
    """

    id: str = pydantic.Field()
    """
    Id of the stop
    """

    issues: typing.Optional[typing.List[GoaIssueTinyResponseResponseBody]] = pydantic.Field(default=None)
    """
    List of issues associated with the stop.
    """

    live_sharing_url: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="liveSharingUrl"),
        pydantic.Field(alias="liveSharingUrl", description="The shareable url of the stop's current status."),
    ] = None
    location_live_sharing_links: typing_extensions.Annotated[
        typing.Optional[typing.List[LiveSharingLinkResponseObjectResponseBody]],
        FieldMetadata(alias="locationLiveSharingLinks"),
        pydantic.Field(
            alias="locationLiveSharingLinks",
            description="List of shareable, non-expired 'By Location' Live Sharing Links.",
        ),
    ] = None
    name: str = pydantic.Field()
    """
    Name of the stop
    """

    notes: typing.Optional[str] = pydantic.Field(default=None)
    """
    Notes for the stop
    """

    ontime_window_after_arrival_ms: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="ontimeWindowAfterArrivalMs"),
        pydantic.Field(
            alias="ontimeWindowAfterArrivalMs",
            description="Specifies the time window (in milliseconds) after a stop's scheduled arrival time during which the stop is considered 'on-time'.",
        ),
    ] = None
    ontime_window_before_arrival_ms: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="ontimeWindowBeforeArrivalMs"),
        pydantic.Field(
            alias="ontimeWindowBeforeArrivalMs",
            description="Specifies the time window (in milliseconds) before a stop's scheduled arrival time during which the stop is considered 'on-time'.",
        ),
    ] = None
    planned_distance_meters: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="plannedDistanceMeters"),
        pydantic.Field(
            alias="plannedDistanceMeters",
            description="Planned driving distance from the previous stop in meters. Based on routing calculations at route creation time. Null for the first stop or if routing data is unavailable.",
        ),
    ] = None
    scheduled_arrival_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="scheduledArrivalTime"),
        pydantic.Field(
            alias="scheduledArrivalTime",
            description="Scheduled arrival time, if it exists, for the stop in RFC 3339 format.",
        ),
    ] = None
    scheduled_departure_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="scheduledDepartureTime"),
        pydantic.Field(
            alias="scheduledDepartureTime",
            description="Scheduled departure time, if it exists, for the stop in RFC 3339 format.",
        ),
    ] = None
    sequence_number: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="sequenceNumber"),
        pydantic.Field(
            alias="sequenceNumber",
            description="Manual sequence position of this stop. Only used when route.settings.sequencingMethod=manual.",
        ),
    ] = None
    single_use_location: typing_extensions.Annotated[
        typing.Optional[RoutesSingleUseAddressObjectResponseBody],
        FieldMetadata(alias="singleUseLocation"),
        pydantic.Field(alias="singleUseLocation"),
    ] = None
    skipped_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="skippedTime"),
        pydantic.Field(
            alias="skippedTime", description="Skipped time, if it exists, for the route stop in RFC 3339 format."
        ),
    ] = None
    state: RoutesStopResponseObjectResponseBodyState = pydantic.Field()
    """
    The current state of the route stop.  Valid values: `unassigned`, `scheduled`, `en route`, `skipped`, `arrived`, `departed`
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
