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

import datetime as dt
import typing

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


class ServiceAccountApiKeyListItem(UniversalBaseModel):
    """
    List item for service account API keys.
    """

    id: str = pydantic.Field()
    """
    API key ID (ak_ prefix)
    """

    key_prefix: str = pydantic.Field()
    """
    Key prefix for identification
    """

    key_name: str = pydantic.Field()
    """
    Human-readable name for the API key
    """

    is_active: bool = pydantic.Field()
    """
    Whether the key is currently active
    """

    is_paused: bool = pydantic.Field()
    """
    Whether the key is temporarily paused
    """

    created_at: dt.datetime = pydantic.Field()
    """
    When the key was created
    """

    last_used_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the key was last used, or null if never used
    """

    expires_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    When the key expires, or null if it does not expire
    """

    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
