feat(domain): herregistratie reminder sweep on a Quartz cron (S-17, closes #18) #121

Merged
not merged 9 commits from feat/18-herregistratie-reminder-sweep into main 2026-07-23 10:31:57 +00:00
Showing only changes of commit 22215865b3 - Show all commits
+22 -6
View File
@@ -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
/// <summary>The date by which herregistratie must happen: inscription + validity. Null until
/// inscribed.</summary>
public DateTimeOffset? HerregistratieVoor => null; // RED stub
public DateTimeOffset? HerregistratieVoor =>
IngeschrevenOp is DateTimeOffset ingeschrevenOp ? ingeschrevenOp + HerregistratieGeldigheid : null;
/// <summary>Whether the herregistratie reminder has been sent for this inscription (S-17).</summary>
public bool HerregistratieReminderVerstuurd { get; private set; }
/// <summary>Whether, as of <paramref name="asOf"/>, 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.</summary>
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.</summary>
public bool HerregistratieReminderDue(DateTimeOffset asOf) =>
Status == RegistrationStatus.Ingeschreven
&& !HerregistratieReminderVerstuurd
&& IngeschrevenOp is DateTimeOffset ingeschrevenOp
&& asOf >= ingeschrevenOp + HerregistratieGeldigheid - Herinneringstermijn;
/// <summary>Record that the herregistratie reminder has been sent. Idempotent — a re-sweep is a
/// no-op; only an inscribed registration can be reminded.</summary>
public void MarkHerregistratieReminderVerstuurd() { } // RED stub
/// no-op (§8.6); only an inscribed registration can be reminded.</summary>
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;
}
/// <summary>
/// Reject the registration — the behandelaar's decision not to enter it in the register. Advances a