# 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 .carb_ctc_vehicle_history_object_response_body_test_result import CarbCtcVehicleHistoryObjectResponseBodyTestResult


class CarbCtcVehicleHistoryObjectResponseBody(UniversalBaseModel):
    """
    A collection history entry for a vehicle enrolled in the CARB CTC program.
    """

    enrollment_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="enrollmentId"),
        pydantic.Field(alias="enrollmentId", description="Unique identifier for this CARB CTC enrollment."),
    ]
    enrollment_vin: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="enrollmentVin"),
        pydantic.Field(
            alias="enrollmentVin", description="Vehicle Identification Number associated with the CARB CTC enrollment."
        ),
    ]
    happened_at_time: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="happenedAtTime"),
        pydantic.Field(alias="happenedAtTime", description="When the collection happened, in RFC 3339 format."),
    ]
    id: str = pydantic.Field()
    """
    Samsara vehicle ID.
    """

    test_result: typing_extensions.Annotated[
        CarbCtcVehicleHistoryObjectResponseBodyTestResult,
        FieldMetadata(alias="testResult"),
        pydantic.Field(
            alias="testResult",
            description="The outcome of the collection test.  Valid values: `pass`, `fail`, `error`, `unknown`",
        ),
    ]
    test_result_details: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="testResultDetails"),
        pydantic.Field(alias="testResultDetails", description="Human-readable context for the test result."),
    ] = 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
