<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();
        
        // Procesar citas recurrentes diariamente a las 8:00 AM
        $schedule->command('appointments:process-recurring')
                 ->dailyAt('08:00')
                 ->appendOutputTo(storage_path('logs/recurring-appointments.log'));
                 
        // Cerrar citas expiradas diariamente a las 00:05 AM
        $schedule->command('appointments:close-expired')
                 ->dailyAt('00:05')
                 ->appendOutputTo(storage_path('logs/expired-appointments.log'));
    }

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

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