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


class OTPRequestRequest(BaseModel):
    """
    Serializer for OTP request.

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

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

    identifier: str = Field(description='Email address or phone number fo...', min_length=1)
    channel: OTPRequestRequestChannel | None = Field(
    None,
    description="Delivery channel: 'email' or 'ph...",
)
    source_url: str | None = Field(None, description='Source URL for tracking registra...')



class OTPRequestResponse(BaseModel):
    """
    OTP request response.

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

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

    message: str = Field(description='Success message')



class OTPErrorResponse(BaseModel):
    """
    Error response for OTP operations.

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

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

    error: str = Field(description='Error message')



class OTPVerifyRequest(BaseModel):
    """
    Serializer for OTP verification.

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

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

    identifier: str = Field(description='Email address or phone number us...', min_length=1)
    otp: str = Field(min_length=6, max_length=6)
    channel: OTPRequestRequestChannel | None = Field(
    None,
    description="Delivery channel: 'email' or 'ph...",
)
    source_url: str | None = Field(None, description='Source URL for tracking login (e...')



class CentrifugoToken(BaseModel):
    """
    Nested serializer for Centrifugo WebSocket connection token.

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

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

    token: str = Field(description='JWT token for Centrifugo WebSock...')
    centrifugo_url: str = Field(description='Centrifugo WebSocket URL')
    expires_at: datetime.datetime = Field(description='Token expiration time (ISO 8601)')
    channels: list[str] = Field(description='List of allowed channels for thi...')



class User(BaseModel):
    """
    Serializer for user details.

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

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

    id: int = ...
    email: str = ...
    first_name: str | None = Field(None, max_length=50)
    last_name: str | None = Field(None, max_length=50)
    full_name: Any = Field(description="Get user's full name.")
    initials: Any = Field(description="Get user's initials for avatar f...")
    display_username: Any = Field(description='Get formatted username for display.')
    company: str | None = Field(None, max_length=100)
    phone: str | None = Field(None, max_length=20)
    position: str | None = Field(None, max_length=100)
    avatar: str | None = None
    is_staff: bool = Field(description='Designates whether the user can ...')
    is_superuser: bool = Field(description='Designates that this user has al...')
    date_joined: datetime.datetime = ...
    last_login: datetime.datetime | None = None
    unanswered_messages_count: int = ...
    centrifugo: CentrifugoToken | None = None



class OTPVerifyResponse(BaseModel):
    """
    OTP verification response. When 2FA is required: - requires_2fa: True -
    session_id: UUID of 2FA verification session - refresh/access/user: null
    When 2FA is not required: - requires_2fa: False - session_id: null -
    refresh/access/user: populated

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

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

    requires_2fa: bool | None = Field(None, description='Whether 2FA verification is requ...')
    session_id: str | None = Field(None, description='2FA session ID (if requires_2fa ...')
    refresh: str | None = Field(None, description='JWT refresh token (if requires_2...')
    access: str | None = Field(None, description='JWT access token (if requires_2f...')
    user: User | None = None
    should_prompt_2fa: bool | None = Field(None, description='Whether user should be prompted ...')



