"""
Overlay image rendering for OCR pipeline — barrel re-export.

All implementation split into:
  ocr_pipeline_overlay_structure — structure overlay (boxes, zones, colors, graphics)
  ocr_pipeline_overlay_grid     — columns, rows, words overlays

Lizenz: Apache 2.0
DATENSCHUTZ: Alle Verarbeitung erfolgt lokal.
"""

from fastapi import HTTPException
from fastapi.responses import Response

from .overlay_structure import _get_structure_overlay  # noqa: F401
from .overlay_grid import (  # noqa: F401
    _get_columns_overlay,
    _get_rows_overlay,
    _get_words_overlay,
)


async def render_overlay(overlay_type: str, session_id: str) -> Response:
    """Dispatch to the appropriate overlay renderer."""
    if overlay_type == "structure":
        return await _get_structure_overlay(session_id)
    elif overlay_type == "columns":
        return await _get_columns_overlay(session_id)
    elif overlay_type == "rows":
        return await _get_rows_overlay(session_id)
    elif overlay_type == "words":
        return await _get_words_overlay(session_id)
    else:
        raise HTTPException(status_code=400, detail=f"Unknown overlay type: {overlay_type}")
