<?php

namespace App\Console;

use App\Jobs\DeductLeaveDays;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected $commands = [
        \App\Console\Commands\InitializeLeaveDaysCommand::class,
    ];


    /**
     * Define the application's command schedule.
     */
    protected function schedule(Schedule $schedule): void
    {
        $schedule->command('clean_logs')->daily();
        // Chạy command 'daily:api-call' vào mỗi ngày lúc 9h sáng
        // $schedule->command('daily:api-call')
        // ->dailyAt('18:00');

        // Chạy command vào ngày 31/12 lúc 23:59:59 mỗi năm
        $schedule->command('initialize:leavedays')->yearlyOn(12, 31, '23:59:59');
        $schedule->command('leave:deduct')->yearlyOn(3, 31, '23:59:59');
    }

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

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