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

namespace StellaOps.Feedser.Source.Kisa;

internal static class KisaJobKinds
{
    public const string Fetch = "source:kisa:fetch";
}

internal sealed class KisaFetchJob : IJob
{
    private readonly KisaConnector _connector;

    public KisaFetchJob(KisaConnector connector)
        => _connector = connector ?? throw new ArgumentNullException(nameof(connector));

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