# 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 .vehicle_stats_aux_input_time import VehicleStatsAuxInputTime
from .vehicle_stats_fault_codes_can_bus_type import VehicleStatsFaultCodesCanBusType
from .vehicle_stats_fault_codes_j_1939 import VehicleStatsFaultCodesJ1939
from .vehicle_stats_fault_codes_obdii import VehicleStatsFaultCodesObdii
from .vehicle_stats_fault_codes_oem import VehicleStatsFaultCodesOem


class VehicleStatsFaultCodes(UniversalBaseModel):
    """
    Engine fault codes read from J1939, OBDII, and OEM vehicles.
    """

    can_bus_type: typing_extensions.Annotated[
        typing.Optional[VehicleStatsFaultCodesCanBusType],
        FieldMetadata(alias="canBusType"),
        pydantic.Field(alias="canBusType"),
    ] = None
    j_1939: typing_extensions.Annotated[
        typing.Optional[VehicleStatsFaultCodesJ1939], FieldMetadata(alias="j1939"), pydantic.Field(alias="j1939")
    ] = None
    obdii: typing.Optional[VehicleStatsFaultCodesObdii] = None
    oem: typing.Optional[VehicleStatsFaultCodesOem] = None
    time: VehicleStatsAuxInputTime

    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
