using System;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.Feedser.Core.Jobs;

namespace StellaOps.Feedser.Source.CertBund;

internal static class CertBundJobKinds
{
    public const string Fetch = "source:cert-bund:fetch";
}

internal sealed class CertBundFetchJob : IJob
{
    private readonly CertBundConnector _connector;

    public CertBundFetchJob(CertBundConnector connector)
        => _connector = connector ?? throw new ArgumentNullException(nameof(connector));

    public Task ExecuteAsync(JobExecutionContext context, CancellationToken cancellationToken)
        => _connector.FetchAsync(context.Services, cancellationToken);
}
