"""Adaptador de extracción de texto PDF reutilizando la utilidad existente."""

from __future__ import annotations

from pathlib import Path

from modules.data_collection.read_pdf import ReadPdf


class PdfTextExtractor:
    """Convierte un PDF local en texto plano para el pipeline batch."""

    def extract_text(self, file_path: str) -> str:
        path = Path(file_path)
        if not path.exists():
            raise FileNotFoundError("No se encontró el archivo PDF extraído.")
        contents = path.read_bytes()
        return ReadPdf.read(contents)
