# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .conditional_field_section_object_response_body import ConditionalFieldSectionObjectResponseBody
from .document_response_object_response_body_state import DocumentResponseObjectResponseBodyState
from .field_object_response_body import FieldObjectResponseBody
from .goa_document_type_tiny_response_response_body import GoaDocumentTypeTinyResponseResponseBody
from .goa_driver_tiny_response_response_body import GoaDriverTinyResponseResponseBody
from .goa_route_stop_tiny_response_response_body import GoaRouteStopTinyResponseResponseBody
from .goa_route_tiny_response_response_body import GoaRouteTinyResponseResponseBody
from .goa_vehicle_tiny_response_response_body import GoaVehicleTinyResponseResponseBody


class DocumentResponseObjectResponseBody(UniversalBaseModel):
    """
    A single document.
    """

    conditional_field_sections: typing_extensions.Annotated[
        typing.Optional[typing.List[ConditionalFieldSectionObjectResponseBody]],
        FieldMetadata(alias="conditionalFieldSections"),
        pydantic.Field(
            alias="conditionalFieldSections", description="List of the document conditional field sections."
        ),
    ] = None
    created_at_time: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="createdAtTime"),
        pydantic.Field(alias="createdAtTime", description="Time the document was created in RFC 3339 format."),
    ]
    document_type: typing_extensions.Annotated[
        GoaDocumentTypeTinyResponseResponseBody,
        FieldMetadata(alias="documentType"),
        pydantic.Field(alias="documentType"),
    ]
    driver: GoaDriverTinyResponseResponseBody
    fields: typing.List[FieldObjectResponseBody] = pydantic.Field()
    """
    The fields associated with this document.
    """

    id: str = pydantic.Field()
    """
    Universally unique identifier for the document.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name of the document.
    """

    notes: typing.Optional[str] = pydantic.Field(default=None)
    """
    Notes on the document.
    """

    route: typing.Optional[GoaRouteTinyResponseResponseBody] = None
    route_stop: typing_extensions.Annotated[
        typing.Optional[GoaRouteStopTinyResponseResponseBody],
        FieldMetadata(alias="routeStop"),
        pydantic.Field(alias="routeStop"),
    ] = None
    state: DocumentResponseObjectResponseBodyState = pydantic.Field()
    """
    The condition of the document created for the driver. Can be either Required or Submitted. Required documents are pre-populated documents for the Driver to fill out in the Driver App and have not yet been submitted. Submitted documents have been submitted by the driver in the Driver App. Archived documents have been archived by the admin in the cloud dashboard.  Valid values: `submitted`, `required`, `archived`
    """

    updated_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="updatedAtTime"),
        pydantic.Field(alias="updatedAtTime", description="Time the document was updated in RFC 3339 format."),
    ] = None
    vehicle: typing.Optional[GoaVehicleTinyResponseResponseBody] = 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
