using Managing.Application.Abstractions.Services;
using Managing.Application.Workers;
using Managing.Application.Workers.Abstractions;
using Managing.Common;

namespace Managing.Api.Workers.Workers;

public class FundingRatesWatcher : BaseWorker<FundingRatesWatcher>
{
    private readonly IStatisticService _statisticService;

    public FundingRatesWatcher(
        ILogger<FundingRatesWatcher> logger,
        IStatisticService statisticService,
        IWorkerService workerService) : base(
        Enums.WorkerType.FundingRatesWatcher,
        logger,
        TimeSpan.FromMinutes(30),
        workerService
    )
    {
        _statisticService = statisticService;
    }

    protected override async Task Run(CancellationToken cancellationToken)
    {
        await _statisticService.UpdateFundingRates();
    }
}