using System.Net.Http;

namespace Watcher.Services;

public class SystemManagement : BackgroundService
{
    private readonly ILogger<NetworkCheck> _logger;

    private ISystemStore _systemStore;

    public SystemManagement(ILogger<NetworkCheck> logger, ISystemStore systemStore)
    {
        _logger = logger;
        _systemStore = systemStore;

    }

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        // Todo: Umstellen auf einmal alle 24h
        var timer = new PeriodicTimer(TimeSpan.FromSeconds(30));

        while (await timer.WaitForNextTickAsync(stoppingToken))
        {
            // Hintergrundprozess abwarten
            await CheckForNewDockerImageVersion();

            // 5 Sekdunden Offset
            await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken);
        }
    }

    public Task CheckForNewDockerImageVersion()
    {
        return Task.CompletedTask;
    }

    public Task CreateDailySqliteBackup()
    {
        return Task.CompletedTask;
    }
}