<?php

namespace App\Console;

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

class Kernel extends ConsoleKernel
{
    protected $commands = [
        Commands\StockClose::class,
        // Daftarkan Command lain Anda di sini
        // Commands\RecalculateStockCommand::class,
        //Commands\CheckLowStock::class,
        // Commands\SendDailyRecap::class,
    ];

    protected function schedule(Schedule $schedule): void
    {
        // WAJIB: Penutupan Stok (Mengunci saldo akhir bulan untuk laporan cepat)
        $schedule->command('stock:close')->monthlyOn(1, '01:00')->onOneServer();

        // Tambahkan jadwal Command lain Anda di sini

        // JADWAL STOK RENDAH: Berjalan otomatis setiap pagi jam 08:00
        //$schedule->command('app:check-low-stock')->dailyAt('08:00')->onOneServer(); // <-- TAMBAHKAN INI

        // $schedule->command('app:send-daily-recap')->dailyAt('17:00')->onOneServer(); 
    }

    protected function commands(): void
    {
        $this->load(__DIR__.'/Commands');
        require base_path('routes/console.php');
    }
}