# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations

from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import ProcessJobJobType, ProcessJobStatus


class ProcessJob(BaseModel):
    """
    Serializer for ProcessJob list view.

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

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

    id: Any = ...
    service: Any = Field(description='Service being operated on')
    service_name: Any = ...
    job_type: ProcessJobJobType = Field(description='Type of operation  * `start` - S...')
    status: ProcessJobStatus = Field(description='Current job status  * `pending` ...')
    rq_job_id: Any = Field(description='RQ job ID for tracking')
    queue_name: Any = Field(description='RQ queue name')
    initiated_by: int | None = Field(None, description='User who initiated the action')
    initiated_by_username: Any = ...
    created_at: Any = ...
    started_at: Any | None = Field(None, description='When job started executing')
    completed_at: Any | None = Field(None, description='When job completed')
    duration_seconds: float | None = Field(None, description='Calculate job duration in seconds.')



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



class ProcessJobDetail(BaseModel):
    """
    Serializer for ProcessJob detail view.

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

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

    id: Any = ...
    service: Any = Field(description='Service being operated on')
    service_name: Any = ...
    job_type: ProcessJobJobType = Field(description='Type of operation  * `start` - S...')
    status: ProcessJobStatus = Field(description='Current job status  * `pending` ...')
    rq_job_id: Any = Field(description='RQ job ID for tracking')
    queue_name: Any = Field(description='RQ queue name')
    initiated_by: int | None = Field(None, description='User who initiated the action')
    initiated_by_username: Any = ...
    created_at: Any = ...
    started_at: Any | None = Field(None, description='When job started executing')
    completed_at: Any | None = Field(None, description='When job completed')
    duration_seconds: float | None = Field(None, description='Calculate job duration in seconds.')
    result: dict[str, Any] | None = Field(None, description='Job result data')
    error_message: str | None = Field(None, description='Error message if failed')
    params: dict[str, Any] | None = Field(None, description='Job parameters')



