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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .device_credential_type_enum import DeviceCredentialTypeEnum


class DeviceCredential(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    ID of this device.
    """

    device_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    User agent for this device
    """

    device_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique identifier for the device. NOTE: This field is generally not populated for refresh_tokens and rotating_refresh_tokens
    """

    type: typing.Optional[DeviceCredentialTypeEnum] = pydantic.Field(default=None)
    """
    Type of credential. Can be `public_key`, `refresh_token`, or `rotating_refresh_token`.
    """

    user_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    user_id this credential is associated with.
    """

    client_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    client_id of the client (application) this credential is for.
    """

    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
