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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .api_key_role import ApiKeyRole
from .api_policy import ApiPolicy
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class ApiKey(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the API key.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The human-readable name of the API key.
    """

    secret_key: typing.Optional[str] = pydantic.Field(default=None)
    """
    The key used in API requests. Should be kept secure.
    """

    enabled: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If this API key is enabled.
    """

    api_key_role: typing.Optional[ApiKeyRole] = None
    api_policy: typing.Optional[ApiPolicy] = 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
