# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations

from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import LogEntryRequestLevel


class ServiceLog(BaseModel):
    """
    Serializer for reading service logs.

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

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

    id: Any = ...
    service: Any = Field(description='Source service')
    service_name: Any = ...
    timestamp: Any = Field(description='Log timestamp (from service)')
    level: LogEntryRequestLevel = Field(description='Log level  * `debug` - Debug * `...')
    message: Any = Field(description='Log message')
    extra: dict[str, Any] = Field(description='Additional context fields')
    error_type: Any = Field(description='Exception type name')
    error_message: Any = Field(description='Exception message')
    stacktrace: Any = Field(description='Full stacktrace')
    run_id: Any = Field(description='Run correlation ID')
    batch_id: Any = Field(description='Batch ID (for deduplication)')
    function: Any = Field(description='Function name where log was created')
    module: Any = Field(description='Module name')
    line_number: int | None = Field(None, description='Line number in source file')
    is_error: bool = ...
    has_exception: bool = ...
    received_at: Any = Field(description='When log was received by API')



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



