<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Models\Settings\Configuration;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        Commands\MailCron::class,
        Commands\ReportsCron::class,
        Commands\TransactionStatusCron::class,
        Commands\RefundCron::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')->hourly();
        $schedule->command('mail:cron')->everyFiveMinutes();
        ////schedule mail to selected email ids with configured time of the reports to be send from configuration settings
        $config_settings = Configuration::first();
        if(isset($config_settings))
        {
            $reports_time = $config_settings->reports_time;
            $refund_initiate_time = $config_settings->refund_initiate_time;
        } 
        
        /////transaction status check ////////////////////////
        $schedule->command('transactionstatus:cron')->everyFifteenMinutes();
       
        ////refund check///////////////////
        $schedule->command('refundcheck:cron')->everyFourHours();        
        //////////////////////////////////////////////////////
    }

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

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