# WP-51 — OpenZaak Documenten (DRC) upload + link Status: done (5807937) Phase: 9 — OpenZaak / ZGW integration ## Why Uploaded documents currently persist as bytes in local SQLite (`DocumentStore`). To be production-ready they must live in OpenZaak's **Documenten API (DRC)** as `enkelvoudiginformatieobjecten`, linked to a Zaak via `zaakinformatieobject` — behind the same config gate, still without a FE contract change. ## Read first - [openzaak-integration.md](../reference/openzaak-integration.md) - WP-49 (the seam pattern), WP-50 (create-zaak, the zaak to link to) ## Decisions (pre-made, don't relitigate) - Introduce an `IDocumentSource` sibling of `IZaakSource`; local impl = `DocumentStore`, OpenZaak impl = DRC. FE upload DTOs unchanged. - A document needs an `informatieobjecttype` **URL** from Catalogi (like zaaktype for a zaak). - Upload → returns document URL → `zaakinformatieobject` links it to the zaak URL. ## Files - `Data/IDocumentSource.cs`, `Data/LocalDocumentSource.cs`, `Zgw/OpenZaakDocumentSource.cs` - `ZgwOptions`: `informatieobjecttype` URL(s) + `DrcBaseUrl`. ## Steps 1. Abstract the upload/read/link paths behind `IDocumentSource`. 2. OpenZaak impl: POST `enkelvoudiginformatieobjecten` (content), then POST `zaakinformatieobjecten`. 3. Map DRC document metadata back into the existing document DTOs. ## Acceptance criteria - [ ] With `Zgw:Enabled=true`, an upload lands in DRC and is linked to its zaak. - [ ] FE upload/list DTOs unchanged; no api-client drift. - [ ] Tests cover the DRC POST bodies + the zaak-link step (stub handler). ## Verification `dotnet test`; against a docker OpenZaak if available. ## Out of scope Notificaties (WP-52), content virus-scanning / blob-storage tuning. ## Risks Large file content over base64/multipart — mind memory; stream if needed.