# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class Links(BaseModel):
    """
    Serializer for extracted links.

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

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

    internal: list[dict[str, Any]] | None = Field(
    None,
    description='Internal links found on the page',
)
    external: list[dict[str, Any]] | None = Field(
    None,
    description='External links found on the page',
)



class ScrapeResponse(BaseModel):
    """
    Response serializer for scrape result.

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

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

    job_id: str = Field(description='Unique job identifier for tracking')
    url: str = Field(description='URL that was scraped')
    success: bool = Field(description='Whether the scrape succeeded')
    markdown: str = Field(description='Page content in Markdown format')
    links: Links | None = None
    status_code: int | None = Field(None, description='HTTP status code of the target page')
    duration_ms: int | None = Field(None, description='Total scrape duration in millise...')
    error: str | None = Field(None, description='Error message if scrape failed')



class ScrapeRequestRequest(BaseModel):
    """
    Request serializer for URL scraping.

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

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

    url: str = Field(description='URL to scrape', min_length=1)
    wait_for_images: bool | None = Field(None, description='Wait for images to load before e...')
    screenshot: bool | None = Field(None, description='Take a screenshot of the page')
    remove_overlays: bool | None = Field(None, description='Remove popups and overlay elements')
    cache: bool | None = Field(None, description='Use cached result if available')
    stealth: bool | None = Field(None, description='Enable stealth mode to bypass an...')
    css_selector: str | None = Field(None, description='CSS selector to extract specific...')



