# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import SDKAPIKeyCreatePermission


class SDKAPIKeyList(BaseModel):
    """
    Serializer for listing SDK API keys (no sensitive data).

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    name: Any = Field(description='Human-readable name for the key')
    key_prefix: Any = Field(description='Visible prefix for identificatio...')
    permission: SDKAPIKeyCreatePermission = Field(
    description='Permission level for this key  *...',
)
    is_active: bool = Field(description='Whether this key can be used')
    is_expired: bool = ...
    is_valid: bool = ...
    is_quota_exceeded: bool = ...
    rate_limit_rpm: int | None = Field(None, description='Max requests per minute (null = ...')
    rate_limit_rpd: int | None = Field(None, description='Max requests per day (null = unl...')
    quota_monthly_usd: Any | None = Field(
    None,
    description='Monthly spending limit in USD (n...',
    pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$',
)
    quota_used_usd: Any = Field(
    description='Amount spent this month in USD',
    pattern='^-?\\d{0,4}(?:\\.\\d{0,6})?$',
)
    last_used_at: datetime.datetime | None = Field(None, description='Last time this key was used')
    total_requests: int = Field(description='Total number of requests made wi...')
    total_cost_usd: Any = Field(
    description='Total cost of all requests in USD',
    pattern='^-?\\d{0,6}(?:\\.\\d{0,6})?$',
)
    expires_at: datetime.datetime | None = Field(
    None,
    description='When this key expires (null = ne...',
)
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...



class PaginatedSDKAPIKeyListList(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    count: int = Field(description='Total number of items across all...')
    page: int = Field(description='Current page number (1-based)')
    pages: int = Field(description='Total number of pages')
    page_size: int = Field(description='Number of items per page')
    has_next: bool = Field(description='Whether there is a next page')
    has_previous: bool = Field(description='Whether there is a previous page')
    next_page: int | None = Field(None, description='Next page number (null if no nex...')
    previous_page: int | None = Field(None, description='Previous page number (null if no...')
    results: list[SDKAPIKeyList] = Field(description='Array of items for current page')



class SDKAPIKeyCreateRequest(BaseModel):
    """
    Serializer for creating new SDK API keys.

    Request model (no read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    name: str = Field(min_length=1, max_length=100)
    permission: SDKAPIKeyCreatePermission | None = Field(
    None,
    description='* `read` - Read Only * `write` -...',
)
    rate_limit_rpm: int | None = Field(None, ge=1)
    rate_limit_rpd: int | None = Field(None, ge=1)
    quota_monthly_usd: Any | None = Field(None, pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    expires_at: datetime.datetime | None = None
    metadata: dict[str, Any] | None = None
    is_test: bool | None = None



class SDKAPIKeyCreate(BaseModel):
    """
    Serializer for creating new SDK API keys.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    name: str = Field(max_length=100)
    permission: SDKAPIKeyCreatePermission | None = Field(
    None,
    description='* `read` - Read Only * `write` -...',
)
    rate_limit_rpm: int | None = Field(None, ge=1)
    rate_limit_rpd: int | None = Field(None, ge=1)
    quota_monthly_usd: Any | None = Field(None, pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    expires_at: datetime.datetime | None = None
    metadata: dict[str, Any] | None = None
    is_test: bool | None = None



class SDKAPIKeyDetail(BaseModel):
    """
    Serializer for SDK API key details.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    name: Any = Field(description='Human-readable name for the key')
    key_prefix: Any = Field(description='Visible prefix for identificatio...')
    permission: SDKAPIKeyCreatePermission = Field(
    description='Permission level for this key  *...',
)
    is_active: bool = Field(description='Whether this key can be used')
    is_expired: bool = ...
    is_valid: bool = ...
    is_quota_exceeded: bool = ...
    rate_limit_rpm: int | None = Field(None, description='Max requests per minute (null = ...')
    rate_limit_rpd: int | None = Field(None, description='Max requests per day (null = unl...')
    quota_monthly_usd: Any | None = Field(
    None,
    description='Monthly spending limit in USD (n...',
    pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$',
)
    quota_used_usd: Any = Field(
    description='Amount spent this month in USD',
    pattern='^-?\\d{0,4}(?:\\.\\d{0,6})?$',
)
    last_used_at: datetime.datetime | None = Field(None, description='Last time this key was used')
    total_requests: int = Field(description='Total number of requests made wi...')
    total_cost_usd: Any = Field(
    description='Total cost of all requests in USD',
    pattern='^-?\\d{0,6}(?:\\.\\d{0,6})?$',
)
    expires_at: datetime.datetime | None = Field(
    None,
    description='When this key expires (null = ne...',
)
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...
    metadata: dict[str, Any] | None = Field(
    None,
    description='Additional metadata (e.g., allow...',
)



