<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Schema;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // Run jobs natively - We could technically use an service worker program or even a systemd timer simply executing this when the opportunity is available.
        $schedule->command('model:prune')->hourly();

        // Run Creatia specific magic
        $schedule->command('arista:unroute')->everyMinute()->withoutOverlapping()->runInBackground();
        $schedule->command('prefix:update-peer')->everyMinute()->withoutOverlapping();
        $schedule->command('geoip:sync')->daily()->withoutOverlapping()->runInBackground();
        $schedule->command('geoip:export')->daily()->withoutOverlapping()->runInBackground();
        $schedule->command('goliath:monitor-agent')->everyMinute();
        $schedule->command('mercury:radb')->everyMinute()->withoutOverlapping();
        $schedule->command('oculi:sync-information')->everyFiveMinutes()->withoutOverlapping();
        $schedule->command('report-sync:lists')->hourly()->withoutOverlapping();
        $schedule->command('utility:system-health-check')->everyMinute()->withoutOverlapping()->runInBackground();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
