# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class ConfigMeta(BaseModel):
    """
    Config metadata.

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

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

    config_class: str = ...
    secret_key_configured: bool = ...



class GitHubOAuthConfig(BaseModel):
    """
    GitHub OAuth configuration.

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

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

    enabled: bool | None = None
    client_id: str | None = None
    client_secret: str | None = None
    scope: list[str] | None = None
    authorize_url: str | None = None
    token_url: str | None = None
    user_api_url: str | None = None
    emails_api_url: str | None = None
    callback_path: str | None = None
    state_timeout_seconds: int | None = None
    allow_account_linking: bool | None = None
    auto_create_user: bool | None = None



class NextJSAdminConfig(BaseModel):
    """
    Next.js Admin application configuration.

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

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

    enabled: bool | None = None
    url: str | None = None
    api_base_url: str | None = None



class SpectacularConfig(BaseModel):
    """
    DRF Spectacular configuration.

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

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

    title: str | None = None
    description: str | None = None
    version: str | None = None



class NgrokConfig(BaseModel):
    """
    Ngrok tunneling configuration.

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

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

    enabled: bool | None = None
    authtoken: str | None = None
    basic_auth: list[str] | None = None
    compression: bool | None = None



class EmailConfig(BaseModel):
    """
    Email configuration.

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

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

    backend: str | None = None
    host: str | None = None
    port: int | None = None
    username: str | None = None
    password: str | None = None
    use_tls: bool | None = None
    use_ssl: bool | None = None
    ssl_verify: bool | None = None
    timeout: int | None = None
    default_from: str | None = None



class GRPCConfigDashboard(BaseModel):
    """
    gRPC configuration for dashboard.

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

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

    enabled: bool | None = None
    host: str | None = None
    port: int | None = None
    public_url: str | None = None
    enable_reflection: bool | None = None
    package_prefix: str | None = None
    output_dir: str | None = None
    handlers_hook: list[str] | None = None
    auto_register_apps: bool | None = None
    enabled_apps: list[str] | None = None
    custom_services: dict[str, Any] | None = None
    server: dict[str, Any] | None = None
    auth: dict[str, Any] | None = None
    proto: dict[str, Any] | None = None
    observability: dict[str, Any] | None = None



class DRFConfig(BaseModel):
    """
    Django REST Framework configuration.

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

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

    default_pagination_class: str | None = None
    page_size: int | None = None



class RedisQueueConfig(BaseModel):
    """
    Redis Queue configuration.

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

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

    url: str | None = None
    host: str | None = None
    port: int | None = None
    db: int | None = None
    username: str | None = None
    password: str | None = None
    default_timeout: int | None = None
    default_result_ttl: int | None = None
    sentinels: dict[str, Any] | None = None
    master_name: str | None = None
    socket_timeout: int | None = None



class RQSchedule(BaseModel):
    """
    Redis Queue schedule configuration.

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

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

    func: str | None = None
    cron_string: str | None = None
    queue: str | None = None
    kwargs: dict[str, Any] | None = None
    args: list[dict[str, Any]] | None = None
    meta: dict[str, Any] | None = None
    repeat: int | None = None
    result_ttl: int | None = None



class DjangoRQConfig(BaseModel):
    """
    Django-RQ configuration.

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

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

    enabled: bool | None = None
    queues: list[RedisQueueConfig] | None = None
    show_admin_link: bool | None = None
    exception_handlers: list[str] | None = None
    api_token: str | None = None
    prometheus_enabled: bool | None = None
    schedules: list[RQSchedule] | None = None



class AxesConfig(BaseModel):
    """
    Django-Axes brute-force protection configuration.

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

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

    enabled: bool | None = None
    failure_limit: int | None = None
    cooloff_time: int | None = None
    lock_out_at_failure: bool | None = None
    reset_on_success: bool | None = None
    only_user_failures: bool | None = None
    lockout_template: str | None = None
    lockout_url: str | None = None
    verbose: bool | None = None
    enable_access_failure_log: bool | None = None
    ipware_proxy_count: int | None = None
    ipware_meta_precedence_order: list[str] | None = None
    allowed_ips: list[str] | None = None
    denied_ips: list[str] | None = None
    cache_name: str | None = None
    use_user_agent: bool | None = None
    username_form_field: str | None = None



class CentrifugoConfig(BaseModel):
    """
    Centrifugo configuration.

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

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

    module_name: str | None = None
    enabled: bool | None = None
    wrapper_url: str | None = None
    wrapper_api_key: str | None = None
    centrifugo_url: str | None = None
    centrifugo_api_url: str | None = None
    centrifugo_api_key: str | None = None
    centrifugo_token_hmac_secret: str | None = None
    default_timeout: int | None = None
    ack_timeout: int | None = None
    http_timeout: int | None = None
    max_retries: int | None = None
    retry_delay: float | None = None
    verify_ssl: bool | None = None
    log_all_calls: bool | None = None
    log_only_with_ack: bool | None = None
    log_level: str | None = None



class TelegramConfig(BaseModel):
    """
    Telegram service configuration.

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

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

    bot_token: str | None = None
    chat_id: int | None = None
    parse_mode: str | None = None
    disable_notification: bool | None = None
    disable_web_page_preview: bool | None = None
    timeout: int | None = None
    webhook_url: str | None = None
    webhook_secret: str | None = None
    max_retries: int | None = None
    retry_delay: float | None = None



class DjangoConfig(BaseModel):
    """
    Typed serializer for user's DjangoConfig settings. Reflects the actual
    structure of DjangoConfig model. All passwords and sensitive data are
    sanitized before reaching this serializer.

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

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

    env_mode: str | None = None
    project_name: str | None = None
    project_logo: str | None = None
    project_version: str | None = None
    project_description: str | None = None
    startup_info_mode: str | None = None
    enable_frontend: bool | None = None
    enable_drf_tailwind: bool | None = None
    enable_pool_cleanup: bool | None = None
    site_url: str | None = None
    api_url: str | None = None
    media_url: str | None = None
    debug: bool | None = None
    debug_warnings: bool | None = None
    root_urlconf: str | None = None
    wsgi_application: str | None = None
    project_apps: list[str] | None = None
    databases: dict[str, Any] | None = None
    redis_url: str | None = None
    cache_default: dict[str, Any] | None = None
    cache_sessions: dict[str, Any] | None = None
    security_domains: list[str] | None = None
    ssl_redirect: bool | None = None
    cors_allow_headers: list[str] | None = None
    email: EmailConfig | None = None
    grpc: GRPCConfigDashboard | None = None
    centrifugo: CentrifugoConfig | None = None
    django_rq: DjangoRQConfig | None = None
    drf: DRFConfig | None = None
    spectacular: SpectacularConfig | None = None
    telegram: TelegramConfig | None = None
    ngrok: NgrokConfig | None = None
    axes: AxesConfig | None = None
    github_oauth: GitHubOAuthConfig | None = None
    crypto_fields: dict[str, Any] | None = None
    unfold: dict[str, Any] | None = None
    admin_timezone: str | None = None
    tailwind_app_name: str | None = None
    tailwind_version: int | None = None
    limits: dict[str, Any] | None = None
    api_keys: dict[str, Any] | None = None
    custom_middleware: list[str] | None = None
    nextjs_admin: NextJSAdminConfig | None = None
    admin_emails: list[str] | None = None
    show_ai_hints: bool | None = None
    _meta: ConfigMeta | None = None



class ConfigValidation(BaseModel):
    """
    Validation result for config serializer.

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

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

    status: str = Field(description="Validation status: 'valid', 'war...")
    missing_in_serializer: list[str] = Field(description='Fields present in config but mis...')
    extra_in_serializer: list[str] = Field(description='Fields present in serializer but...')
    type_mismatches: list[dict[str, Any]] = Field(description='Fields with type mismatches')
    total_config_fields: int = Field(description='Total fields in config')
    total_serializer_fields: int = Field(description='Total fields in serializer')



class ConfigData(BaseModel):
    """
    Serializer for complete config data endpoint. Returns both DjangoConfig and
    Django settings with validation info.

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

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

    django_config: DjangoConfig = ...
    django_settings: dict[str, Any] = Field(description='Complete Django settings (saniti...')
    _validation: ConfigValidation = ...



