# 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


class AssociationResponseBody(UniversalBaseModel):
    """
    An association between a central device (e.g. vehicle gateway) and a peripheral device.
    """

    association_end_time: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="associationEndTime"),
        pydantic.Field(
            alias="associationEndTime",
            description="The time when this association ended, in RFC 3339 format. Null if the association is still active.",
        ),
    ] = None
    association_start_time: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="associationStartTime"),
        pydantic.Field(
            alias="associationStartTime", description="The time when this association started, in RFC 3339 format."
        ),
    ]
    central_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="centralId"),
        pydantic.Field(alias="centralId", description="The Samsara ID of the central device in this association."),
    ]
    peripheral_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="peripheralId"),
        pydantic.Field(
            alias="peripheralId", description="The Samsara ID of the peripheral device in this association."
        ),
    ]
    peripheral_name: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="peripheralName"),
        pydantic.Field(
            alias="peripheralName", description="The human-readable name of the peripheral device, if available."
        ),
    ] = 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
