using Big.Application;
using Microsoft.Extensions.Logging;
using Quartz;
namespace Big.Infrastructure;
///
/// The Quartz job that fires the herregistratie reminder sweep on a cron schedule (S-17, ADR-0022).
/// A deliberately thin shell — it resolves the pure (Quartz's
/// MS-DI job factory gives each fire its own scope) and logs how many reminders went out; all the
/// sweep logic is unit-tested in the application layer. Quartz drives this — rather than a
/// BackgroundService poll loop like the pumps — because it is a time-triggered fleet sweep, not a
/// queue to drain (the distinction recorded in ADR-0022).
/// stops a slow sweep overlapping the next fire against the shared store.
///
[DisallowConcurrentExecution]
public sealed class HerregistratieReminderJob(
HerregistratieReminderSweep sweep, ILogger logger) : IJob
{
public async Task Execute(IJobExecutionContext context)
{
var reminded = await sweep.SweepAsync(context.CancellationToken);
logger.LogInformation(
"Herregistratie-sweep voltooid: {Count} herinnering(en) verstuurd.", reminded.Count);
}
}