"""Data models for the broken link checker."""
from typing import Literal
from pydantic import BaseModel, Field, HttpUrl
class LinkResult(BaseModel):
"""Result for a single link check."""
page_url: str = Field(..., description="The page where the link appears")
link_reference: str = Field(..., description="The anchor text or element type")
link_url: str = Field(..., description="The target URL being checked")
status: Literal["Good", "Bad"] = Field(..., description="Link status")
class CheckSummary(BaseModel):
"""Summary statistics for a check operation."""
total_links: int = Field(..., description="Total number of links checked")
good_links: int = Field(..., description="Number of working links")
bad_links: int = Field(..., description="Number of broken links")
pages_scanned: int = Field(1, description="Number of pages scanned")
class CheckResult(BaseModel):
"""Complete result of a link check operation."""
results: list[LinkResult] = Field(default_factory=list)
summary: CheckSummary
class LinkInfo(BaseModel):
"""Internal model for link information during extraction."""
url: str
reference: str # Anchor text or element type like "<img>"
element_type: str # 'a', 'img', 'script', 'link', 'video', etc.