# 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 .policy_violations_detection_alert_settings_object_response_body_events_available_for_testing_item import (
    PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsAvailableForTestingItem,
)
from .policy_violations_detection_alert_settings_object_response_body_events_to_coach_item import (
    PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsToCoachItem,
)


class PolicyViolationsDetectionAlertSettingsObjectResponseBody(UniversalBaseModel):
    """
    Enables detection of policy violations, surfaces events in Safety Inbox, and enables configurable alerts. While the feature is in beta, in-cab alerts are recommended for testing use only.
    """

    events_available_for_testing: typing_extensions.Annotated[
        typing.Optional[
            typing.List[PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsAvailableForTestingItem]
        ],
        FieldMetadata(alias="eventsAvailableForTesting"),
        pydantic.Field(
            alias="eventsAvailableForTesting",
            description="List of selectable beta policy violation events to be tested.",
        ),
    ] = None
    events_to_coach: typing_extensions.Annotated[
        typing.Optional[typing.List[PolicyViolationsDetectionAlertSettingsObjectResponseBodyEventsToCoachItem]],
        FieldMetadata(alias="eventsToCoach"),
        pydantic.Field(
            alias="eventsToCoach", description="List of selectable policy violation events to enable coaching for."
        ),
    ] = 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 rolling stops 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 rolling stops 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
