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, }