# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class ScheduleInfo(BaseModel):
    """
    Schedule information in config response.

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

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

    func: str = ...
    queue: str = ...
    cron: str | None = None
    interval: int | None = None
    scheduled_time: datetime.datetime | None = None
    description: str | None = None
    timeout: int | None = None
    result_ttl: int | None = None
    repeat: int | None = None



class RQConfig(BaseModel):
    """
    RQ configuration serializer. Returns current RQ configuration from
    django-cfg.

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

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

    enabled: bool = Field(description='RQ enabled status')
    queues: dict[str, Any] = Field(description='Configured queues')
    async_mode: bool | None = Field(None, description='Async mode enabled')
    show_admin_link: bool | None = Field(None, description='Show admin link')
    prometheus_enabled: bool | None = Field(None, description='Prometheus metrics enabled')
    api_token_configured: bool | None = Field(None, description='API token is configured')
    schedules: list[ScheduleInfo] | None = Field(
    None,
    description='Scheduled tasks from django-cfg ...',
)



class RQHealthCheck(BaseModel):
    """
    Health check response serializer. Provides overall RQ cluster health status.

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

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

    status: str = Field(description='Health status (healthy/degraded/...')
    worker_count: int = Field(description='Total number of active workers')
    queue_count: int = Field(description='Number of configured queues')
    total_jobs: int = Field(description='Total jobs across all queues')
    timestamp: datetime.datetime = Field(description='Health check timestamp')
    enabled: bool = Field(description='RQ enabled status')
    redis_connected: bool = Field(description='Redis connection status')
    wrapper_url: str | None = Field(None, description='Wrapper URL (optional)')
    has_api_key: bool | None = Field(None, description='API key configured status')



