"""Official Python SDK for the Presa HTML-to-PDF API."""

from presa.client import Presa
from presa.errors import ApiError, AuthenticationError, PresaError, TimeoutError
from presa.types import GenerateOptions, GenerateResult, Margins, PresaConfig

__all__ = [
    "ApiError",
    "AuthenticationError",
    "GenerateOptions",
    "GenerateResult",
    "Margins",
    "PDF",
    "Presa",
    "PresaConfig",
    "PresaError",
    "TimeoutError",
]


class _PDFNamespace:
    """Convenience namespace for static-style usage.

    Example::

        from presa import PDF

        result = PDF.generate(html="<h1>Hello</h1>")
    """

    @staticmethod
    def generate(
        html: str,
        **kwargs: object,
    ) -> GenerateResult:
        """Generate a PDF from HTML using a default client.

        Reads ``PRESA_API_KEY`` from the environment automatically.
        """
        client = Presa()
        return client.generate(GenerateOptions(html=html, **kwargs))  # type: ignore[arg-type]


PDF = _PDFNamespace()
