# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations

from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import CommandCommandType, CommandStatus


class Command(BaseModel):
    """
    Serializer for reading commands.

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

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

    id: Any = ...
    service: Any = Field(description='Target service')
    service_name: Any = ...
    issued_by: int | None = Field(None, description='User who issued the command')
    issued_by_name: Any = ...
    command_type: CommandCommandType = Field(description='Type of command  * `start` - Sta...')
    params: dict[str, Any] = Field(description='Command parameters')
    priority: int = Field(description='Command priority (higher = more ...')
    status: CommandStatus = Field(description='Command status  * `pending` - Pe...')
    result: dict[str, Any] = Field(description='Command execution result')
    error_message: Any = Field(description='Error message if failed')
    created_at: Any = ...
    acknowledged_at: Any | None = Field(None, description='When service acknowledged the co...')
    completed_at: Any | None = Field(None, description='When command execution completed')
    expires_at: Any | None = Field(None, description='When command expires if not exec...')
    is_pending: bool = ...
    is_completed: bool = ...
    is_expired: bool = ...



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



