# 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 .attribute_attribute_type import AttributeAttributeType
from .attribute_entity_type import AttributeEntityType
from .attribute_unit import AttributeUnit
from .attribute_value_tiny import AttributeValueTiny


class Attribute(UniversalBaseModel):
    attribute_type: typing_extensions.Annotated[
        typing.Optional[AttributeAttributeType],
        FieldMetadata(alias="attributeType"),
        pydantic.Field(
            alias="attributeType",
            description="Denotes the data type of the attribute's values. Valid values: `single-select`, `multi-select`, `text`, `freeform-multi-select`, `number`, `date`.",
        ),
    ] = None
    entity_type: typing_extensions.Annotated[
        typing.Optional[AttributeEntityType],
        FieldMetadata(alias="entityType"),
        pydantic.Field(
            alias="entityType",
            description="Denotes the type of entity, driver or asset. Valid values: `driver`, `asset`.",
        ),
    ] = None
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The samsara id of the attribute object.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name of attribute.
    """

    number_values: typing_extensions.Annotated[
        typing.Optional[typing.List[float]],
        FieldMetadata(alias="numberValues"),
        pydantic.Field(
            alias="numberValues",
            description="Number values that can be associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`",
        ),
    ] = None
    string_values: typing_extensions.Annotated[
        typing.Optional[typing.List[str]],
        FieldMetadata(alias="stringValues"),
        pydantic.Field(
            alias="stringValues",
            description="String values that can be associated with this attribute. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`",
        ),
    ] = None
    unit: typing.Optional[AttributeUnit] = pydantic.Field(default=None)
    """
    Unit of the attribute (only for Number attributes).
    """

    values: typing.Optional[typing.List[AttributeValueTiny]] = pydantic.Field(default=None)
    """
    Representation of values that includes ids. Note: this field is `null` for `text` and `freeform-multi-select` attribute types.`
    """

    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
