<?php

namespace App\Console;

use App\Console\Commands\FluxOrderFix;
use App\Console\Commands\InventoryDailyLoggingOwner;
use App\Console\Commands\LogExpireDelete;
use App\Console\Commands\MakeServiceCommand;
use App\Console\Commands\SyncBatchTask;
use App\Console\Commands\SyncLogCacheTask;
use App\Console\Commands\SyncUserVisitMenuLogsCacheTask;
use App\Console\Commands\SyncWmsCommoditiesInformation;
use App\Console\Commands\SyncWMSOrderTask;
use App\Console\Commands\TestTemp;
use App\Console\Commands\WASSyncWMSOrderInformation;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Foundation\Console\ModelMakeCommand;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        LogExpireDelete::class,
        MakeServiceCommand::class,
        FluxOrderFix::class,
        InventoryDailyLoggingOwner::class,
        WASSyncWMSOrderInformation::class,
        SyncLogCacheTask::class,
        SyncUserVisitMenuLogsCacheTask::class,
        TestTemp::class,
        SyncBatchTask::class,
        SyncWMSOrderTask::class,
        SyncWmsCommoditiesInformation::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('LogExpireDelete')->dailyAt('00:01');
        $schedule->command('InventoryDailyLoggingOwner')->dailyAt('08:00');
        $schedule->command('FluxOrderFix')->hourlyAt(1);
        $schedule->command('WASSyncWMSOrderInformation')->everyMinute();
        $schedule->command('syncLogCacheTask')->everyMinute();
        $schedule->command('createOwnerReport')->monthlyOn(1);
        $schedule->command('createOwnerBillReport')->monthlyOn(1);
        $schedule->command('createOwnerAreaReport')->monthlyOn(25);
        $schedule->command('sync:batch')->everyMinute();
        $schedule->command('sync:order')->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');
        $this->app->extend('command.model.make',function(ModelMakeCommand $base,$app){
            return new \App\Console\Commands\ModelMakeCommand($app['files']);
        });
        require base_path('routes/console.php');
    }
}
