# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class JobList(BaseModel):
    """
    Job list item serializer. Provides basic job information for list views.

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

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

    id: str = Field(description='Job ID')
    func_name: str = Field(description='Function name')
    created_at: datetime.datetime = Field(description='Job creation time')
    status: str = Field(description='Job status (queued/started/finis...')
    queue: str = Field(description='Queue name')
    timeout: int | None = Field(None, description='Job timeout in seconds')



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



class JobDetail(BaseModel):
    """
    Detailed job information serializer. Provides comprehensive job details
    including result and metadata.

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

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

    id: str = Field(description='Job ID')
    func_name: str = Field(description='Function name')
    args: list[dict[str, Any]] | None = Field(
    None,
    description='Function arguments (array of any...',
)
    kwargs: dict[str, Any] | None = Field(None, description='Function keyword arguments')
    created_at: datetime.datetime = Field(description='Job creation time')
    enqueued_at: datetime.datetime | None = Field(None, description='Job enqueue time')
    started_at: datetime.datetime | None = Field(None, description='Job start time')
    ended_at: datetime.datetime | None = Field(None, description='Job end time')
    status: str = Field(description='Job status (queued/started/finis...')
    queue: str = Field(description='Queue name')
    worker_name: str | None = Field(None, description='Worker name if started')
    timeout: int | None = Field(None, description='Job timeout in seconds')
    result_ttl: int | None = Field(None, description='Result TTL in seconds')
    failure_ttl: int | None = Field(None, description='Failure TTL in seconds')
    result: dict[str, Any] | None = Field(None, description='Job result if finished')
    exc_info: str | None = Field(None, description='Exception info if failed')
    meta: dict[str, Any] | None = Field(None, description='Job metadata')
    dependency_ids: list[str] | None = Field(None, description='List of dependency job IDs')



class JobActionResponse(BaseModel):
    """
    Job action response serializer. Used for job management actions (requeue,
    delete, etc.).

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

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

    success: bool = Field(description='Action success status')
    message: str = Field(description='Action result message')
    job_id: str = Field(description='Job ID')
    action: str = Field(description='Action performed (requeue/delete...')



class JobListRequest(BaseModel):
    """
    Job list item serializer. Provides basic job information for list views.

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

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

    id: str = Field(description='Job ID', min_length=1)
    func_name: str = Field(description='Function name', min_length=1)
    created_at: datetime.datetime = Field(description='Job creation time')
    status: str = Field(description='Job status (queued/started/finis...', min_length=1)
    queue: str = Field(description='Queue name', min_length=1)
    timeout: int | None = Field(None, description='Job timeout in seconds')



