"""Data Entry module router factory."""

from fastapi import APIRouter


def create_data_entry_router() -> APIRouter:
    """
    Create and configure Data Entry module router.

    Includes all data entry endpoints:
    - /receipts - Receipt CRUD and workflow
    - /ocr - OCR processing for receipts
    - /nomenclature - Nomenclature syncing from Oracle
    - /settings - User settings (OCR preferences)
    - /metrics - OCR analytics and metrics
    - /bulk - Bulk upload for batch processing

    Returns:
        APIRouter: Configured router for data entry module
    """
    router = APIRouter()

    # Import routers here to avoid circular imports
    from .receipts import router as receipts_router
    from .ocr import router as ocr_router
    from .nomenclature import router as nomenclature_router
    from .ocr_settings import router as ocr_settings_router
    from .bulk import router as bulk_router

    # Include all sub-routers (no prefix - already prefixed in main.py with /api/data-entry)
    router.include_router(receipts_router, prefix="/receipts", tags=["data-entry-receipts"])
    router.include_router(ocr_router, prefix="/ocr", tags=["data-entry-ocr"])
    router.include_router(nomenclature_router, prefix="/nomenclature", tags=["data-entry-nomenclature"])
    # OCR settings and metrics (endpoints at /settings/* and /metrics/*)
    router.include_router(ocr_settings_router, tags=["data-entry-settings"])
    # Bulk upload for batch processing
    router.include_router(bulk_router, prefix="/bulk", tags=["data-entry-bulk"])

    return router
