# >>> pipelex-codegen-stamp >>>
# crate_fingerprint: 38d02d151de391f760bcaa1bf1c376cd617a598964f13db2fcfab0930e1322d1
# engine_version: 0.57.0
# projection: types / python-pydantic
# options: {}
# content_hash: 851d1b768c089a94be893f66ba5325d6dc27f5c73124ea353c4f5486a97954f2
# <<< pipelex-codegen-stamp <<<
# ---------------------------------------------------------------------------
# AUTOGENERATED by Pipelex codegen — DO NOT EDIT.
#
# This file is a projection of a normalized MTHDS library crate. It is
# regenerated from the method; any hand edit here is overwritten.
#
# To customize a generated type, do NOT edit this file. Create a sibling
# module and subclass — subclasses survive regeneration:
#
#     # my_types_ext.py
#     from .structures import Report
#
#     class MyReport(Report):
#         ...
#
# projection: types / python-pydantic
# ---------------------------------------------------------------------------
from __future__ import annotations

from pydantic import BaseModel, Field


class Document(BaseModel):
    """A document"""

    url: str = Field(
        ...,
        description="The document URL: a storage URI, an HTTP(S) URL, or a base64 data URL",
    )
    public_url: str | None = Field(
        default=None,
        description="The public HTTPS URL of the document",
    )
    mime_type: str | None = Field(
        default=None,
        description="The MIME type of the document",
    )
    filename: str | None = Field(
        default=None,
        description="The original filename of the document",
    )
    title: str | None = Field(
        default=None,
        description="The title of the document or source",
    )
    snippet: str | None = Field(
        default=None,
        description="A text snippet or excerpt from the document",
    )


class Image(BaseModel):
    """An image"""

    url: str = Field(
        ...,
        description="The image URL: a storage URI, an HTTP(S) URL, or a base64 data URL",
    )
    public_url: str | None = Field(
        default=None,
        description="The public URL of the image",
    )
    source_prompt: str | None = Field(
        default=None,
        description="The source prompt of the image",
    )
    source_negative_prompt: str | None = Field(
        default=None,
        description="The source negative prompt of the image",
    )
    caption: str | None = Field(default=None, description="The caption of the image")
    mime_type: str | None = Field(
        default=None,
        description="The MIME type of the image",
    )
    width: int | None = Field(
        default=None,
        description="The width of the image, in pixels",
    )
    height: int | None = Field(
        default=None,
        description="The height of the image, in pixels",
    )
    filename: str | None = Field(
        default=None,
        description="The original filename of the image",
    )


class Page(BaseModel):
    """The content of a page of a document, comprising text and linked images and an optional page view image"""

    text_and_images: TextAndImages = Field(
        ...,
        description="The text and images content extracted from the page",
    )
    page_view: Image | None = Field(
        default=None,
        description="The screenshot of the page",
    )


class Text(BaseModel):
    """A text"""

    text: str = Field(..., description="The text")


class TextAndImages(BaseModel):
    """A text and an image"""

    text: Text | None = Field(default=None, description="A text content")
    images: list[Image] | None = Field(
        default=None,
        description="A list of images that were extracted from the text",
    )
    raw_html: str | None = Field(
        default=None,
        description="The raw HTML of the fetched page, if requested",
    )
