<?php

namespace App\Console;

use App\Console\Anime\AnimeCheckImgUrlCommand;
use App\Console\Test\RegisterUserCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected $commands = [
        Test\TestCommand::class,
        RegisterUserCommand::class,
        AnimeCheckImgUrlCommand::class,
        Commands\ProcessImageGenerationQueueCommand::class,
    ];


    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // 每分钟检查一次图片生成任务状态
        $schedule->command('AIGeneration:checkImgTasks')->everyMinute();
        
        // 每分钟检查一次视频生成任务状态
        $schedule->command('AIGeneration:checkVideoTasks')->everyMinute();

        // 没分钟检查一次动漫对话图片生成状态
        $schedule->command('Anime:checkImgUrl')->everyMinute();
        
        // 每30秒处理一次图片生成任务队列
        $schedule->command('image-generation:process-queue')->everyMinute();
    }

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

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