# 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 .goa_driver_tiny_response_response_body import GoaDriverTinyResponseResponseBody
from .hos_violation_day_object_response_body import HosViolationDayObjectResponseBody
from .hos_violation_object_response_body_type import HosViolationObjectResponseBodyType


class HosViolationObjectResponseBody(UniversalBaseModel):
    day: HosViolationDayObjectResponseBody
    description: str = pydantic.Field()
    """
    Description containing violation type, region, and other metadata. This field can assume the following formats for the following types:
    californiaMealbreakMissed, restbreakMissed: "[description] ([max on duty hours] hours)"
    cycleHoursOn, dailyDrivingHours, dailyOffDutyNonResetHours, dailyOffDutyTotalHours, dailyOnDutyHours, shiftDrivingHours, shiftHours, shiftOnDutyHours: "[description] ([region]-[max hours in duty status] hours)"
    cycleOffHoursAfterOnDutyHours: "[description] ([region]): [minimum hours consecutive rest] hours off duty required after [max hours before consecutive rest] hours on-duty time"
    dailyOffDutyDeferralAddToDay2Consecutive, dailyOffDutyDeferralNotPartMandatory, dailyOffDutyDeferralTwoDayDrivingLimit, dailyOffDutyDeferralTwoDayOffDuty, mandatory24HoursOffDuty: "[description] ([region])"
    unsubmittedLogs: "Missing Driver Certification"
    """

    driver: GoaDriverTinyResponseResponseBody
    duration_ms: typing_extensions.Annotated[
        int,
        FieldMetadata(alias="durationMs"),
        pydantic.Field(
            alias="durationMs",
            description="Duration the driver was in violation in milliseconds. This is the time between the time the driver starts being in violation until the end of the time window for violations that have one (e.g. `shiftDrivingHours`) or until the end of the day. The duration of some violations may cover the whole day (e.g. `unsubmittedLogs`).",
        ),
    ]
    type: HosViolationObjectResponseBodyType = pydantic.Field()
    """
    The string value of the violation type.  Valid values: `NONE`, `californiaMealbreakMissed`, `cycleHoursOn`, `cycleOffHoursAfterOnDutyHours`, `dailyDrivingHours`, `dailyOffDutyDeferralAddToDay2Consecutive`, `dailyOffDutyDeferralNotPartMandatory`, `dailyOffDutyDeferralTwoDayDrivingLimit`, `dailyOffDutyDeferralTwoDayOffDuty`, `dailyOffDutyNonResetHours`, `dailyOffDutyTotalHours`, `dailyOnDutyHours`, `mandatory24HoursOffDuty`, `restbreakMissed`, `shiftDrivingHours`, `shiftHours`, `shiftOnDutyHours`, `unsubmittedLogs`
    """

    violation_start_time: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="violationStartTime"),
        pydantic.Field(alias="violationStartTime", description="The start time of the violation in RFC 3339 format."),
    ]

    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
