# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class Worker(BaseModel):
    """
    Worker information serializer. Provides detailed information about an RQ
    worker.

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

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

    name: str = Field(description='Worker name/ID')
    queues: list[str] | None = Field(None, description='List of queue names')
    state: str = Field(description='Worker state (idle/busy/suspended)')
    current_job: str | None = Field(None, description='Current job ID if busy')
    birth: datetime.datetime = Field(description='Worker start time')
    last_heartbeat: datetime.datetime = Field(description='Last heartbeat timestamp')
    successful_job_count: int | None = Field(None, description='Total successful jobs')
    failed_job_count: int | None = Field(None, description='Total failed jobs')
    total_working_time: float | None = Field(None, description='Total working time in seconds')



class WorkerStats(BaseModel):
    """
    Aggregated worker statistics serializer. Provides overview of all workers
    across all queues.

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

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

    total_workers: int = Field(description='Total number of workers')
    busy_workers: int | None = Field(None, description='Number of busy workers')
    idle_workers: int | None = Field(None, description='Number of idle workers')
    suspended_workers: int | None = Field(None, description='Number of suspended workers')
    total_successful_jobs: int | None = Field(
    None,
    description='Total successful jobs (all workers)',
)
    total_failed_jobs: int | None = Field(None, description='Total failed jobs (all workers)')
    total_working_time: float | None = Field(
    None,
    description='Total working time across all wo...',
)
    workers: list[Worker] | None = Field(None, description='List of individual workers')



