<?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('media:optimize')->hourlyAt(40)->onOneServer();
        $schedule->command('media:gc')->hourlyAt(5)->onOneServer();
        $schedule->command('horizon:snapshot')->everyFiveMinutes()->onOneServer();
        $schedule->command('story:gc')->everyFiveMinutes()->onOneServer();
        $schedule->command('gc:failedjobs')->dailyAt(3)->onOneServer();
        $schedule->command('gc:passwordreset')->dailyAt('09:41')->onOneServer();
        $schedule->command('gc:sessions')->twiceDaily(13, 23)->onOneServer();

        if(config('import.instagram.enabled')) {
            $schedule->command('app:transform-imports')->everyTenMinutes()->onOneServer();
            $schedule->command('app:import-upload-garbage-collection')->hourlyAt(51)->onOneServer();
            $schedule->command('app:import-remove-deleted-accounts')->hourlyAt(37)->onOneServer();
            $schedule->command('app:import-upload-clean-storage')->twiceDailyAt(1, 13, 32)->onOneServer();

            if(config('import.instagram.storage.cloud.enabled') && (bool) config_cache('pixelfed.cloud_storage')) {
                $schedule->command('app:import-upload-media-to-cloud-storage')->hourlyAt(39)->onOneServer();
            }
        }

        $schedule->command('app:notification-epoch-update')->weeklyOn(1, '2:21')->onOneServer();
        $schedule->command('app:hashtag-cached-count-update')->hourlyAt(25)->onOneServer();
        $schedule->command('app:account-post-count-stat-update')->everySixHours(25)->onOneServer();
    }

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

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