"""The documents API. Split by what a caller is doing, not by HTTP verb: browsing, the life of one document, its audit trail, the approval workflow, and department sharing. The shared gates live in `access.py` and the shared response shapes in `view.py`, so a rule like "an author keeps access to their own document" exists once. **Route order matters.** FastAPI matches in registration order, so `browse` goes first: after `/{document_id}` exists, a request for `/search` would be parsed as a document id. """ from fastapi import APIRouter from app.api.documents import browse, crud, history, sharing, workflow from app.api.documents.access import readable_document, require_editor router = APIRouter() router.include_router(browse.router) router.include_router(crud.router) router.include_router(history.router) router.include_router(workflow.router) router.include_router(sharing.router) # The authoring API works on documents the caller may change, so it shares # this package's gate rather than growing a second one. __all__ = ["readable_document", "require_editor", "router"]