# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class TelegramBotResponse(BaseModel):
    """
    Response serializer for bot info. Token is never included.

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

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

    alias: str = ...
    bot_username: str = ...
    bot_id: int | None = None
    is_active: bool = ...
    webhook_set: bool = ...
    callback_url: str = ...
    consecutive_errors: int = ...
    last_used_at: datetime.datetime | None = None
    created_at: datetime.datetime = ...



class TelegramSetWebhookRequest(BaseModel):
    """
    Request serializer for updating callback URL.

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

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

    callback_url: str = Field(description='New URL to receive incoming Tele...', min_length=1)



class TelegramVerifyCodeRequest(BaseModel):
    """
    
    Request model (no read-only fields).
    """

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

    code: str = Field(min_length=1, max_length=10)



class TelegramRegisterBotRequest(BaseModel):
    """
    Request serializer for bot registration.

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

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

    alias: str = Field(
    description='Unique bot alias for SDK calls (...',
    min_length=1,
    max_length=64,
    pattern='^[-a-zA-Z0-9_]+$',
)
    token: str = Field(
    description='Real Telegram bot token from @Bo...',
    min_length=1,
    max_length=512,
)
    callback_url: str | None = Field(None, description='URL to receive incoming Telegram...')



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

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

    alias: str = ...
    phone: str = ...
    status: str = ...
    is_active: bool = ...
    tg_username: str = ...
    tg_first_name: str = ...
    created_at: datetime.datetime = ...
    last_used_at: datetime.datetime | None = None



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



class TelegramBotListItem(BaseModel):
    """
    Compact bot info for list views.

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

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

    alias: str = ...
    bot_username: str = ...
    bot_id: int | None = None
    is_active: bool = ...
    webhook_set: bool = ...
    created_at: datetime.datetime = ...



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



class TelegramVerify2FARequest(BaseModel):
    """
    
    Request model (no read-only fields).
    """

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

    password: str = Field(min_length=1)



class TelegramRegisterAccountRequest(BaseModel):
    """
    
    Request model (no read-only fields).
    """

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

    alias: str = Field(min_length=1, max_length=64, pattern='^[-a-zA-Z0-9_]+$')
    phone: str = Field(min_length=1, max_length=20)
    api_id: int = ...
    api_hash: str = Field(min_length=1, max_length=64)



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

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

    alias: str = ...
    phone: str = ...
    status: str = ...



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

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

    alias: str = ...
    phone: str = ...
    status: str = ...
    is_active: bool = ...
    tg_user_id: int | None = None
    tg_username: str = ...
    tg_first_name: str = ...
    created_at: datetime.datetime = ...
    last_used_at: datetime.datetime | None = None



