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

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .driver_tiny_response import DriverTinyResponse
from .location import Location
from .safety_event_behavior_labels import SafetyEventBehaviorLabels
from .safety_event_coaching_state import SafetyEventCoachingState
from .safety_event_download_forward_video_url import SafetyEventDownloadForwardVideoUrl
from .safety_event_download_inward_video_url import SafetyEventDownloadInwardVideoUrl
from .safety_event_download_tracked_inward_video_url import SafetyEventDownloadTrackedInwardVideoUrl
from .safety_event_id import SafetyEventId
from .safety_event_max_acceleration_g_force import SafetyEventMaxAccelerationGForce
from .safety_event_time import SafetyEventTime
from .vehicle_tiny_response import VehicleTinyResponse


class SafetyEvent(UniversalBaseModel):
    """
    A safety event.
    """

    behavior_labels: typing_extensions.Annotated[
        typing.Optional[SafetyEventBehaviorLabels],
        FieldMetadata(alias="behaviorLabels"),
        pydantic.Field(alias="behaviorLabels"),
    ] = None
    coaching_state: typing_extensions.Annotated[
        typing.Optional[SafetyEventCoachingState],
        FieldMetadata(alias="coachingState"),
        pydantic.Field(alias="coachingState"),
    ] = None
    download_forward_video_url: typing_extensions.Annotated[
        typing.Optional[SafetyEventDownloadForwardVideoUrl],
        FieldMetadata(alias="downloadForwardVideoUrl"),
        pydantic.Field(alias="downloadForwardVideoUrl"),
    ] = None
    download_inward_video_url: typing_extensions.Annotated[
        typing.Optional[SafetyEventDownloadInwardVideoUrl],
        FieldMetadata(alias="downloadInwardVideoUrl"),
        pydantic.Field(alias="downloadInwardVideoUrl"),
    ] = None
    download_tracked_inward_video_url: typing_extensions.Annotated[
        typing.Optional[SafetyEventDownloadTrackedInwardVideoUrl],
        FieldMetadata(alias="downloadTrackedInwardVideoUrl"),
        pydantic.Field(alias="downloadTrackedInwardVideoUrl"),
    ] = None
    driver: typing.Optional[DriverTinyResponse] = None
    id: typing.Optional[SafetyEventId] = None
    location: typing.Optional[Location] = None
    max_acceleration_g_force: typing_extensions.Annotated[
        typing.Optional[SafetyEventMaxAccelerationGForce],
        FieldMetadata(alias="maxAccelerationGForce"),
        pydantic.Field(alias="maxAccelerationGForce"),
    ] = None
    time: typing.Optional[SafetyEventTime] = None
    vehicle: typing.Optional[VehicleTinyResponse] = 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
