From ca9964f79bd843a1e63137b1d15d08e2680a164d Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Mon, 13 Jul 2026 16:45:36 +0200 Subject: [PATCH] feat(domain): add the Ingeschreven state and Registration.Approve() (refs #75) Approve() advances a submitted registration with an opened zaak to INGESCHREVEN; re-approval and approval-before-zaak are rejected as invalid transitions. Co-Authored-By: Claude Opus 4.8 (1M context) --- services/domain/Big.Domain/Registration.cs | 19 +++++++++++++++++++ .../domain/Big.Domain/RegistrationStatus.cs | 7 +++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/services/domain/Big.Domain/Registration.cs b/services/domain/Big.Domain/Registration.cs index d6f2d85..be1f1ea 100644 --- a/services/domain/Big.Domain/Registration.cs +++ b/services/domain/Big.Domain/Registration.cs @@ -64,4 +64,23 @@ public sealed class Registration ZaakUrl = zaakUrl; } + + /// + /// Approve the registration — the behandelaar's decision to enter it in the register. Advances + /// . + /// Requires an opened zaak (the approval sets that zaak's status via the ACL), and only a + /// submitted registration can be approved: re-approving is rejected as an invalid transition. + /// + public void Approve() + { + if (ZaakUrl is null) + throw new InvalidOperationException( + $"Registration {Id} has no zaak yet; it cannot be approved before its zaak is opened."); + + if (Status != RegistrationStatus.Ingediend) + throw new InvalidOperationException( + $"Registration {Id} is {Status}; only an INGEDIEND registration can be approved."); + + Status = RegistrationStatus.Ingeschreven; + } } diff --git a/services/domain/Big.Domain/RegistrationStatus.cs b/services/domain/Big.Domain/RegistrationStatus.cs index 3ddad57..60bb171 100644 --- a/services/domain/Big.Domain/RegistrationStatus.cs +++ b/services/domain/Big.Domain/RegistrationStatus.cs @@ -1,10 +1,13 @@ namespace Big.Domain; /// The lifecycle states a moves through. The walking -/// skeleton knows only ; withdrawal, beoordeling and herregistratie -/// states arrive in their own slices (Iteration 2+). +/// skeleton knows and the terminal ; withdrawal, +/// beoordeling and herregistratie states arrive in their own slices (Iteration 2+). public enum RegistrationStatus { /// Submitted by the zorgprofessional; the registratie process has been started. Ingediend, + + /// Approved: entered in the register. Terminal in the walking skeleton (S-09b). + Ingeschreven, }