using PARR.AIHITMainSyncer;

namespace PARR.AIHITSyncerWorker
{
    public class Worker : BackgroundService
    {
        private readonly ILogger<Worker> _logger;
        private readonly IAihitMainSyncer aihitSyncer;

        public Worker(ILogger<Worker> logger, IAihitMainSyncer aihitSyncer)
        {
            _logger = logger;
            this.aihitSyncer = aihitSyncer;
        }


        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            await aihitSyncer.StartAsync();
            await Task.Delay(Timeout.Infinite, stoppingToken);
        }


        public override Task StopAsync(CancellationToken cancellationToken)
        {
            aihitSyncer.StopAsync();
            return base.StopAsync(cancellationToken);
        }
    }
}
