<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\ServiceProvider;

/**
 * Class ScheduleServiceProvider
 */
final class ScheduleServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        $this->callAfterResolving(Schedule::class, function (Schedule $schedule) {
            $schedule
                ->command('queue:retry all')
                ->everyThirtyMinutes()
                ->withoutOverlapping(10)
                ->onOneServer()
                ->emailOutputOnFailure('logs@seka.sk');

            // Kontrola kazdu minutu pre presne zverejnenie informacii
            $schedule
                ->command('informacie:publish-scheduled')
                ->everyMinute()
                ->withoutOverlapping()
                ->emailOutputOnFailure('logs@seka.sk');

            $schedule
                ->command('notifikacia:overenie-platnosti-tokenov --odstranit-neplatne')
                ->withoutOverlapping()
                ->dailyAt('04:00')
                ->emailOutputTo('logs@seka.sk');
        });
    }
}
