# 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 .anticipation_brake_event_count import AnticipationBrakeEventCount
from .coasting_duration_ms import CoastingDurationMs
from .cruise_control_duration_ms import CruiseControlDurationMs
from .distance_driven_meters import DistanceDrivenMeters
from .drive_time_duration_ms import DriveTimeDurationMs
from .extended_driver_tiny_response import ExtendedDriverTinyResponse
from .fuel_consumed_ml import FuelConsumedMl
from .green_band_driving_duration_ms import GreenBandDrivingDurationMs
from .high_torque_ms import HighTorqueMs
from .idle_time_duration_ms import IdleTimeDurationMs
from .over_speed_ms import OverSpeedMs
from .power_take_off_duration_ms import PowerTakeOffDurationMs
from .total_brake_event_count import TotalBrakeEventCount
from .vehicle_summary import VehicleSummary


class DriverEfficiency(UniversalBaseModel):
    """
    Summary of a driver's efficiency.
    """

    anticipation_brake_event_count: typing_extensions.Annotated[
        typing.Optional[AnticipationBrakeEventCount],
        FieldMetadata(alias="anticipationBrakeEventCount"),
        pydantic.Field(alias="anticipationBrakeEventCount"),
    ] = None
    coasting_duration_ms: typing_extensions.Annotated[
        typing.Optional[CoastingDurationMs],
        FieldMetadata(alias="coastingDurationMs"),
        pydantic.Field(alias="coastingDurationMs"),
    ] = None
    cruise_control_duration_ms: typing_extensions.Annotated[
        typing.Optional[CruiseControlDurationMs],
        FieldMetadata(alias="cruiseControlDurationMs"),
        pydantic.Field(alias="cruiseControlDurationMs"),
    ] = None
    driver: typing.Optional[ExtendedDriverTinyResponse] = None
    green_band_driving_duration_ms: typing_extensions.Annotated[
        typing.Optional[GreenBandDrivingDurationMs],
        FieldMetadata(alias="greenBandDrivingDurationMs"),
        pydantic.Field(alias="greenBandDrivingDurationMs"),
    ] = None
    high_torque_ms: typing_extensions.Annotated[
        typing.Optional[HighTorqueMs], FieldMetadata(alias="highTorqueMs"), pydantic.Field(alias="highTorqueMs")
    ] = None
    over_speed_ms: typing_extensions.Annotated[
        typing.Optional[OverSpeedMs], FieldMetadata(alias="overSpeedMs"), pydantic.Field(alias="overSpeedMs")
    ] = None
    total_brake_event_count: typing_extensions.Annotated[
        typing.Optional[TotalBrakeEventCount],
        FieldMetadata(alias="totalBrakeEventCount"),
        pydantic.Field(alias="totalBrakeEventCount"),
    ] = None
    total_distance_driven_meters: typing_extensions.Annotated[
        typing.Optional[DistanceDrivenMeters],
        FieldMetadata(alias="totalDistanceDrivenMeters"),
        pydantic.Field(alias="totalDistanceDrivenMeters"),
    ] = None
    total_drive_time_duration_ms: typing_extensions.Annotated[
        typing.Optional[DriveTimeDurationMs],
        FieldMetadata(alias="totalDriveTimeDurationMs"),
        pydantic.Field(alias="totalDriveTimeDurationMs"),
    ] = None
    total_fuel_consumed_ml: typing_extensions.Annotated[
        typing.Optional[FuelConsumedMl],
        FieldMetadata(alias="totalFuelConsumedMl"),
        pydantic.Field(alias="totalFuelConsumedMl"),
    ] = None
    total_idle_time_duration_ms: typing_extensions.Annotated[
        typing.Optional[IdleTimeDurationMs],
        FieldMetadata(alias="totalIdleTimeDurationMs"),
        pydantic.Field(alias="totalIdleTimeDurationMs"),
    ] = None
    total_power_take_off_duration_ms: typing_extensions.Annotated[
        typing.Optional[PowerTakeOffDurationMs],
        FieldMetadata(alias="totalPowerTakeOffDurationMs"),
        pydantic.Field(alias="totalPowerTakeOffDurationMs"),
    ] = None
    vehicle_summaries: typing_extensions.Annotated[
        typing.Optional[typing.List[VehicleSummary]],
        FieldMetadata(alias="vehicleSummaries"),
        pydantic.Field(
            alias="vehicleSummaries",
            description="Summaries of vehicle efficiency for each vehicle the driver was driving during the given time period.",
        ),
    ] = 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
