# 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 .dvir_defects_object_v_20220913_response_body import DvirDefectsObjectV20220913ResponseBody
from .goa_trailer_tiny_response_response_body import GoaTrailerTinyResponseResponseBody
from .workflow_author_signature_object_response_body import WorkflowAuthorSignatureObjectResponseBody
from .workflow_dvir_object_response_body_safety_status import WorkflowDvirObjectResponseBodySafetyStatus
from .workflow_dvir_object_response_body_type import WorkflowDvirObjectResponseBodyType


class WorkflowDvirObjectResponseBody(UniversalBaseModel):
    """
    A DVIR description
    """

    author_signature: typing_extensions.Annotated[
        WorkflowAuthorSignatureObjectResponseBody,
        FieldMetadata(alias="authorSignature"),
        pydantic.Field(alias="authorSignature"),
    ]
    defects: typing.Optional[typing.List[DvirDefectsObjectV20220913ResponseBody]] = pydantic.Field(default=None)
    """
    Defects registered for the DVIR.
    """

    end_time: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="endTime"),
        pydantic.Field(
            alias="endTime",
            description="Time when the driver signed and completed this DVIR. UTC timestamp in RFC 3339 format.",
        ),
    ]
    formatted_location: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="formattedLocation"),
        pydantic.Field(
            alias="formattedLocation",
            description="Optional string if your jurisdiction requires a location of the DVIR.",
        ),
    ] = None
    id: str = pydantic.Field()
    """
    The unique id of the DVIR
    """

    mechanic_notes: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="mechanicNotes"),
        pydantic.Field(alias="mechanicNotes", description="The mechanics notes on the DVIR."),
    ] = None
    needs_correction: typing_extensions.Annotated[
        bool,
        FieldMetadata(alias="needsCorrection"),
        pydantic.Field(alias="needsCorrection", description="Indicates if a defect needs correction."),
    ]
    odometer_meters: typing_extensions.Annotated[
        typing.Optional[int],
        FieldMetadata(alias="odometerMeters"),
        pydantic.Field(alias="odometerMeters", description="The odometer reading in meters."),
    ] = None
    safety_status: typing_extensions.Annotated[
        WorkflowDvirObjectResponseBodySafetyStatus,
        FieldMetadata(alias="safetyStatus"),
        pydantic.Field(
            alias="safetyStatus",
            description="The condition of vehicle on which DVIR was done.  Valid values: `safe`, `unsafe`, `resolved`",
        ),
    ]
    second_signature: typing_extensions.Annotated[
        typing.Optional[WorkflowAuthorSignatureObjectResponseBody],
        FieldMetadata(alias="secondSignature"),
        pydantic.Field(alias="secondSignature"),
    ] = None
    start_time: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="startTime"),
        pydantic.Field(
            alias="startTime", description="Time when driver began filling out this DVIR in RFC 3339 format."
        ),
    ]
    third_signature: typing_extensions.Annotated[
        typing.Optional[WorkflowAuthorSignatureObjectResponseBody],
        FieldMetadata(alias="thirdSignature"),
        pydantic.Field(alias="thirdSignature"),
    ] = None
    trailer: typing.Optional[GoaTrailerTinyResponseResponseBody] = None
    type: WorkflowDvirObjectResponseBodyType = pydantic.Field()
    """
    Inspection type of the DVIR.  Valid values: `preTrip`, `postTrip`, `mechanic`, `unspecified`
    """

    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
