"""Models for the /v1/search endpoint."""

from pydantic import BaseModel, Field

from .common import OutputFormat
from .scrape import ScrapeResponse


class SearchRequest(BaseModel):
    query: str = Field(..., min_length=1, max_length=500)
    num_results: int = Field(default=5, ge=1, le=10)
    formats: list[OutputFormat] = [OutputFormat.MARKDOWN]
    include_metadata: bool = True


class SearchResponse(BaseModel):
    success: bool
    query: str
    results: list[ScrapeResponse] = []
    total: int = 0
    error: str | None = None
