# 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_driver_tiny_response_response_body import GoaDriverTinyResponseResponseBody
from .minimal_route_stop_response_body import MinimalRouteStopResponseBody
from .route_stop_details_object_response_body_operation import RouteStopDetailsObjectResponseBodyOperation
from .route_stop_details_object_response_body_type import RouteStopDetailsObjectResponseBodyType
from .vehicle_with_gateway_tiny_response_response_body import VehicleWithGatewayTinyResponseResponseBody
from .webhook_route_response_object_response_body import WebhookRouteResponseObjectResponseBody


class RouteStopDetailsObjectResponseBody(UniversalBaseModel):
    driver: typing.Optional[GoaDriverTinyResponseResponseBody] = None
    operation: typing.Optional[RouteStopDetailsObjectResponseBodyOperation] = pydantic.Field(default=None)
    """
    The operation that was performed as part of this route update.  Valid values: `stop arrived`, `stop departed`
    """

    route: WebhookRouteResponseObjectResponseBody
    route_stop_details: typing_extensions.Annotated[
        MinimalRouteStopResponseBody, FieldMetadata(alias="routeStopDetails"), pydantic.Field(alias="routeStopDetails")
    ]
    time: dt.datetime = pydantic.Field()
    """
    The timestamp of the route in RFC 3339 format.
    """

    type: RouteStopDetailsObjectResponseBodyType = pydantic.Field()
    """
    The type of route update. The route tracking updates occur as a route is completed and stops transition from one state to another. Currently only Route Tracking updates are supported, but this will change in the future when additional types are added.  Valid values: `route tracking`
    """

    vehicle: typing.Optional[VehicleWithGatewayTinyResponseResponseBody] = None

    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
