<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Laravel\Nova\Fields\Attachments\PruneStaleAttachments;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     */
    protected function schedule(Schedule $schedule): void
    {
        // Remove unnecessary documents...
        $schedule->exec('rm -rf '.public_path('app-docs/*'))->everyMinute();

        // Remove non saved attachments...
        $schedule->call(new PruneStaleAttachments)->daily();

        // IF any warnings unresolved warnings exists, send notify me
       $schedule->call(new WarnDev)->dailyAt('16:00');
    }

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

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