# This file was auto-generated by Fern from our API Definition.

from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .product_type import ProductType
from .device_code_status import DeviceCodeStatus
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class DeviceCode(UncheckedBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique id for this device code.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    An optional user-defined name for the device code.
    """

    code: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique code that can be used to login.
    """

    device_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The unique id of the device that used this code. Populated when the device is paired up.
    """

    product_type: ProductType = pydantic.Field(default="TERMINAL_API")
    """
    The targeting product type of the device code.
    """

    location_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The location assigned to this code.
    """

    status: typing.Optional[DeviceCodeStatus] = pydantic.Field(default=None)
    """
    The pairing status of the device code.
    See [DeviceCodeStatus](#type-devicecodestatus) for possible values
    """

    pair_by: typing.Optional[str] = pydantic.Field(default=None)
    """
    When this DeviceCode will expire and no longer login. Timestamp in RFC 3339 format.
    """

    created_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    When this DeviceCode was created. Timestamp in RFC 3339 format.
    """

    status_changed_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    When this DeviceCode's status was last changed. Timestamp in RFC 3339 format.
    """

    paired_at: typing.Optional[str] = pydantic.Field(default=None)
    """
    When this DeviceCode was paired. Timestamp in RFC 3339 format.
    """

    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
