# 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 .address_address_types_item import AddressAddressTypesItem
from .address_external_ids import AddressExternalIds
from .address_geofence import AddressGeofence
from .contact_tiny_response import ContactTinyResponse
from .tag_tiny_response import TagTinyResponse


class Address(UniversalBaseModel):
    """
    An Address object.
    """

    address_types: typing_extensions.Annotated[
        typing.Optional[typing.List[AddressAddressTypesItem]],
        FieldMetadata(alias="addressTypes"),
        pydantic.Field(
            alias="addressTypes",
            description="Reporting location type associated with the address (used for ELD reporting purposes). Valid values: `yard`, `shortHaul`, `workforceSite`, `riskZone`, `industrialSite`, `alertsOnly`, `agricultureSource`, `avoidanceZone`, `knownGPSJammingZone`, `authorizedZone`, `unauthorizedZone`, `vendor`, `inventory`.",
        ),
    ] = None
    contacts: typing.Optional[typing.List[ContactTinyResponse]] = pydantic.Field(default=None)
    """
    An array Contact mini-objects that are associated the Address.
    """

    created_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="createdAtTime"),
        pydantic.Field(
            alias="createdAtTime", description="The date and time this address was created in RFC 3339 format."
        ),
    ] = None
    external_ids: typing_extensions.Annotated[
        typing.Optional[AddressExternalIds],
        FieldMetadata(alias="externalIds"),
        pydantic.Field(
            alias="externalIds",
            description="The [external IDs](https://developers.samsara.com/docs/external-ids) for the given object.",
        ),
    ] = None
    formatted_address: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="formattedAddress"),
        pydantic.Field(
            alias="formattedAddress",
            description="The full street address for this address/geofence, as it might be recognized by Google Maps.",
        ),
    ]
    geofence: AddressGeofence
    id: str = pydantic.Field()
    """
    ID of the Address.
    """

    latitude: typing.Optional[float] = pydantic.Field(default=None)
    """
    Latitude of the address. Will be geocoded from `formattedAddress` if not provided.
    """

    longitude: typing.Optional[float] = pydantic.Field(default=None)
    """
    Longitude of the address. Will be geocoded from `formattedAddress` if not provided.
    """

    name: str = pydantic.Field()
    """
    Name of the address.
    """

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

    tags: typing.Optional[typing.List[TagTinyResponse]] = pydantic.Field(default=None)
    """
    An array of all tag mini-objects that are associated with the given address entry.
    """

    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
