"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .httpmetadata import HTTPMetadata, HTTPMetadataTypedDict
import pydantic
from typing import Any, Dict, Optional
from typing_extensions import Annotated, NotRequired, TypedDict
from unkey_py.types import BaseModel, Nullable


class WhoamiRequestBodyTypedDict(TypedDict):
    key: str
    r"""The actual key to fetch"""


class WhoamiRequestBody(BaseModel):
    key: str
    r"""The actual key to fetch"""


class WhoamiIdentityTypedDict(TypedDict):
    r"""The identity object associated with the key"""

    id: str
    r"""The identity ID associated with the key"""
    external_id: str
    r"""The external identity ID associated with the key"""


class WhoamiIdentity(BaseModel):
    r"""The identity object associated with the key"""

    id: str
    r"""The identity ID associated with the key"""

    external_id: Annotated[str, pydantic.Field(alias="externalId")]
    r"""The external identity ID associated with the key"""


class WhoamiResponseBodyTypedDict(TypedDict):
    r"""The configuration for a single key"""

    id: str
    r"""The ID of the key"""
    created_at: int
    r"""The timestamp in milliseconds when the key was created"""
    enabled: bool
    r"""Whether the key is enabled"""
    name: NotRequired[str]
    r"""The name of the key"""
    remaining: NotRequired[int]
    r"""The remaining number of requests for the key"""
    identity: NotRequired[WhoamiIdentityTypedDict]
    r"""The identity object associated with the key"""
    meta: NotRequired[Dict[str, Nullable[Any]]]
    r"""Metadata associated with the key"""
    environment: NotRequired[str]
    r"""The environment the key is associated with"""


class WhoamiResponseBody(BaseModel):
    r"""The configuration for a single key"""

    id: str
    r"""The ID of the key"""

    created_at: Annotated[int, pydantic.Field(alias="createdAt")]
    r"""The timestamp in milliseconds when the key was created"""

    enabled: bool
    r"""Whether the key is enabled"""

    name: Optional[str] = None
    r"""The name of the key"""

    remaining: Optional[int] = None
    r"""The remaining number of requests for the key"""

    identity: Optional[WhoamiIdentity] = None
    r"""The identity object associated with the key"""

    meta: Optional[Dict[str, Nullable[Any]]] = None
    r"""Metadata associated with the key"""

    environment: Optional[str] = None
    r"""The environment the key is associated with"""


class WhoamiResponseTypedDict(TypedDict):
    http_meta: HTTPMetadataTypedDict
    object: NotRequired[WhoamiResponseBodyTypedDict]
    r"""The configuration for a single key"""


class WhoamiResponse(BaseModel):
    http_meta: Annotated[Optional[HTTPMetadata], pydantic.Field(exclude=True)] = None

    object: Optional[WhoamiResponseBody] = None
    r"""The configuration for a single key"""
