# 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 .device_asset_response_response_body import DeviceAssetResponseResponseBody
from .device_response_response_body_model import DeviceResponseResponseBodyModel
from .goa_tag_tiny_response_response_body import GoaTagTinyResponseResponseBody
from .health_response_response_body import HealthResponseResponseBody
from .last_known_location_response_response_body import LastKnownLocationResponseResponseBody


class DeviceResponseResponseBody(UniversalBaseModel):
    """
    Information about a device including its identity, last known location, last connected time, and health status.
    """

    asset: DeviceAssetResponseResponseBody
    health: typing.Optional[HealthResponseResponseBody] = None
    last_connected_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="lastConnectedTime"),
        pydantic.Field(
            alias="lastConnectedTime", description="The last time the device was connected, in RFC 3339 format."
        ),
    ] = None
    last_known_location: typing_extensions.Annotated[
        typing.Optional[LastKnownLocationResponseResponseBody],
        FieldMetadata(alias="lastKnownLocation"),
        pydantic.Field(alias="lastKnownLocation"),
    ] = None
    model: DeviceResponseResponseBodyModel = pydantic.Field()
    """
    The product model name of the device.  Valid values: `AG24`, `AG24EU`, `AG26`, `AG26EU`, `AG45`, `AG45EU`, `AG46`, `AG46EU`, `AG46P`, `AG46PEU`, `AG51`, `AG51EU`, `AG52`, `AG52EU`, `AG53`, `AG53EU`, `AT11`, `AT11X`, `CM31`, `CM32`, `CM33`, `CM34`, `OEM`, `OEMP`, `OEMR`, `OEMV`, `VG34`, `VG34EU`, `VG34FN`, `VG34M`, `VG54EU`, `VG54NA`, `VG55EU`, `VG55NA`
    """

    serial: str = pydantic.Field()
    """
    The serial number of the device.
    """

    tags: typing.Optional[typing.List[GoaTagTinyResponseResponseBody]] = pydantic.Field(default=None)
    """
    The list of [tags](https://kb.samsara.com/hc/en-us/articles/360026674631-Using-Tags-and-Tag-Nesting) associated with the Device.
    """

    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
