using JSMR.Application.Enums; using JSMR.Application.Scanning; using JSMR.Worker.Options; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace JSMR.Worker.Services; public sealed class ScanJob(ILogger log, IOptions options, ScanVoiceWorksHandler handler) { private readonly ScanOptions _options = options.Value; public async Task RunOnceAsync(CancellationToken cancellationToken) { log.LogInformation("Starting scan: Locale={Locale}, Start Page={StartPage}, EndPage={EndPage}", _options.Locale, _options.StartPage, _options.EndPage); ScanVoiceWorksRequest request = new( PageNumber: 1, PageSize: 100, Locale: Enum.Parse(_options.Locale, true) ); await handler.HandleAsync(request, cancellationToken); log.LogInformation("Scan completed."); } }