<?php

namespace App\Scheduler;

use App\Message\RefreshAndDownloadChapters;
use Symfony\Component\Scheduler\RecurringMessage;
use Symfony\Component\Scheduler\Schedule;
use Symfony\Component\Scheduler\ScheduleProviderInterface;
use Symfony\Contracts\Cache\CacheInterface;

// Désactivé : remplacé par MonitoringSchedule (DDD) dans src/Domain/Manga/Infrastructure/Scheduler/
class MainSchedule implements ScheduleProviderInterface
{
    public function __construct(private CacheInterface $cache)
    {
    }

    #[\Override] public function getSchedule(): Schedule
    {
        return (new Schedule())->add(
            RecurringMessage::every('6 hours', new RefreshAndDownloadChapters())
        )
            ->stateful($this->cache);
    }
}
