"""Document API package — router aggregator.

Aggregates upload_router, crud_router, and content_router under a single
APIRouter with prefix="/api/documents". This is the ONLY file in the package
that sets the prefix — sub-routers declare no prefix (D-04).

main.py import unchanged after decomposition:
  from api.documents import router as documents_router
  app.include_router(documents_router)
"""
from fastapi import APIRouter

from api.documents.upload import router as upload_router
from api.documents.crud import router as crud_router, list_documents
from api.documents.content import router as content_router
# Re-export for test monkeypatching: tests patch api.documents.extract_and_classify.delay
# (same Celery task object as upload.py uses — patching .delay affects all callers)
from tasks.document_tasks import extract_and_classify  # noqa: F401
from storage import get_storage_backend_for_document  # noqa: F401

router = APIRouter(prefix="/api/documents", tags=["documents"])
router.include_router(upload_router)
# list_documents registered directly on parent: FastAPI 0.100+ disallows include_router
# when the include prefix AND route path are both empty strings (our sub-router pattern
# uses no prefix per D-04, and the list endpoint has path="").
router.add_api_route("", list_documents, methods=["GET"])
router.include_router(crud_router)
router.include_router(content_router)
