# 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 DeviceListStatus


class DeviceList(BaseModel):
    """
    Serializer for listing TOTP devices.

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

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

    id: str = ...
    name: Any = Field(description='Device name for identification')
    is_primary: bool = Field(description='Primary device used for verifica...')
    status: DeviceListStatus = Field(description='* `pending` - Pending Confirmati...')
    created_at: datetime.datetime = ...
    confirmed_at: datetime.datetime | None = Field(
    None,
    description='When device setup was confirmed',
)
    last_used_at: datetime.datetime | None = Field(
    None,
    description='Last successful verification',
)



class DeviceListResponse(BaseModel):
    """
    Response serializer for device list endpoint.

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

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

    devices: list[DeviceList] = ...
    has_2fa_enabled: bool = ...



class PaginatedDeviceListResponseList(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[DeviceListResponse] = Field(description='Array of items for current page')



class DisableRequest(BaseModel):
    """
    Serializer for completely disabling 2FA.

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

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

    code: str = Field(description='TOTP code for verification', min_length=6, max_length=6)



