using System;
using System.Threading;
using System.Threading.Tasks;

namespace StellaOps.Scanner.Worker.Processing;

public sealed class AnalyzerStageExecutor : IScanStageExecutor
{
    private readonly IScanAnalyzerDispatcher _dispatcher;

    public AnalyzerStageExecutor(IScanAnalyzerDispatcher dispatcher)
    {
        _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
    }

    public string StageName => ScanStageNames.ExecuteAnalyzers;

    public ValueTask ExecuteAsync(ScanJobContext context, CancellationToken cancellationToken)
        => _dispatcher.ExecuteAsync(context, cancellationToken);
}
