using FrameworkDAL.DTO.SchedulerTaskGenerator;
using GB5Shared.QueueReader;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
namespace FrameworkSL.Controllers.SchedulerTaskGenerator
{
///
/// Polls TJOBQUEUE for "SCHEDULER_ACTION_EVENT" messages enqueued by
/// SchedulerExecutionDeliveryService (on job completion) and routes them to
/// SchedulerActionEventPublishHandler. Registered as AddHostedService in Program.cs.
///
/// This is TJOBQUEUE's new job as of 2026-08-20 — the scheduler's own webhook delivery
/// (Track A) no longer routes through TJOBQUEUE (see SchedulerExecutionPoller's header
/// comment); TJOBQUEUE is now purely the action-dispatch queue for scheduler jobs that
/// have a configured MACTION (mail/SMS/webhook/etc via the existing EventSub pipeline).
///
public sealed class SchedulerActionEventQueueProcessor : BaseJobQueueProcessor
{
public SchedulerActionEventQueueProcessor(
IServiceScopeFactory scopeFactory,
ILogger logger)
: base(scopeFactory, logger)
{
}
protected override IReadOnlyList MessageTypes { get; } =
new[] { SchedulerActionEventConstants.MessageType };
// Tracker §47/§48 — this processor genuinely IS "the scheduler" (Track A's own action
// dispatch queue), unlike PAYJobQueueProcessor/PAYQueueProcessor/MMJobQueueProcessor,
// which never override this and so keep polling every STATUS=1 tenant exactly as before.
protected override string? AdditionalTenantFilterSql => "SERVERCONFIG1.SCHEDULERENABLED = 1";
}
}