From 22215865b321038d930f9b89f8899dbf863795f5 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Thu, 23 Jul 2026 11:51:47 +0200 Subject: [PATCH] feat(domain): record inscription date + herregistratie reminder-due rule (refs #18) Approve stores the inscription moment; HerregistratieVoor derives the deadline (inscription + 5-year validity); HerregistratieReminderDue(asOf) is true once the 16-week window before the deadline opens for a still-un-reminded inscription; MarkHerregistratieReminderVerstuurd is idempotent and guards against reminding a non-inscribed registration. refs #18 --- services/domain/Big.Domain/Registration.cs | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/services/domain/Big.Domain/Registration.cs b/services/domain/Big.Domain/Registration.cs index 3aea662..ea19202 100644 --- a/services/domain/Big.Domain/Registration.cs +++ b/services/domain/Big.Domain/Registration.cs @@ -105,7 +105,7 @@ public sealed class Registration RequireOpenForDecision(nameof(Approve)); Status = RegistrationStatus.Ingeschreven; - // RED stub: the inscription moment is not stored yet. + IngeschrevenOp = ingeschrevenOp; } // --- Herregistratie (S-17) โ€” RED stubs, implemented in the green commit --------------------- @@ -125,19 +125,35 @@ public sealed class Registration /// The date by which herregistratie must happen: inscription + validity. Null until /// inscribed. - public DateTimeOffset? HerregistratieVoor => null; // RED stub + public DateTimeOffset? HerregistratieVoor => + IngeschrevenOp is DateTimeOffset ingeschrevenOp ? ingeschrevenOp + HerregistratieGeldigheid : null; /// Whether the herregistratie reminder has been sent for this inscription (S-17). public bool HerregistratieReminderVerstuurd { get; private set; } /// Whether, as of , this registration is due a herregistratie /// reminder: it is inscribed, the reminder window before its deadline has opened, and it has not - /// already been reminded. - public bool HerregistratieReminderDue(DateTimeOffset asOf) => false; // RED stub + /// already been reminded. Once inside the window it stays due until reminded (an overdue inscription + /// is still due). This is the single rule the store query and the sweep both build on. + public bool HerregistratieReminderDue(DateTimeOffset asOf) => + Status == RegistrationStatus.Ingeschreven + && !HerregistratieReminderVerstuurd + && IngeschrevenOp is DateTimeOffset ingeschrevenOp + && asOf >= ingeschrevenOp + HerregistratieGeldigheid - Herinneringstermijn; /// Record that the herregistratie reminder has been sent. Idempotent โ€” a re-sweep is a - /// no-op; only an inscribed registration can be reminded. - public void MarkHerregistratieReminderVerstuurd() { } // RED stub + /// no-op (ยง8.6); only an inscribed registration can be reminded. + public void MarkHerregistratieReminderVerstuurd() + { + if (HerregistratieReminderVerstuurd) + return; + + if (Status != RegistrationStatus.Ingeschreven) + throw new InvalidOperationException( + $"Registration {Id} is {Status}; only an INGESCHREVEN registration can be sent a herregistratie reminder."); + + HerregistratieReminderVerstuurd = true; + } /// /// Reject the registration โ€” the behandelaar's decision not to enter it in the register. Advances a