# 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


class FollowingDistanceDetectionAlertSettingsObjectResponseBody(UniversalBaseModel):
    """
    Enables AI detection of tailgating or unsafe following distances, surfaces events in Safety Inbox, and enables configurable alerts. By default, Following Distance will impact the drivers' safety score.
    """

    duration_ms: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="durationMs"),
        pydantic.Field(
            alias="durationMs",
            description="Duration of following distance at which to alert, measured in milliseconds.",
        ),
    ] = None
    has_in_cab_audio_alerts_enabled: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="hasInCabAudioAlertsEnabled"),
        pydantic.Field(
            alias="hasInCabAudioAlertsEnabled",
            description="Indicates whether in-cab audio alerts for following distance are turned on.",
        ),
    ] = None
    is_enabled: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="isEnabled"),
        pydantic.Field(
            alias="isEnabled", description="Indicates whether AI event detection for following distance is turned on."
        ),
    ] = None
    speeding_threshold_mph: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="speedingThresholdMph"),
        pydantic.Field(alias="speedingThresholdMph", description="Alert when speed is over this many miles per hour."),
    ] = 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
