<?php

declare(strict_types=1);

namespace App\Application;

use App\Framework\Console\ConsoleColor;
use App\Framework\Console\ConsoleCommand;
use App\Framework\Console\ConsoleInput;
use App\Framework\Console\ConsoleOutput;
use App\Framework\Console\ExitCode;

/**
 * Demo command to showcase the auto-generated help system
 *
 * This command demonstrates various parameter types and
 * showcases how the help system automatically generates
 * comprehensive documentation from method signatures.
 */
final readonly class DemoHelpCommand
{
    #[ConsoleCommand(
        name: 'demo:help',
        description: 'Demonstrates the auto-generated help system with various parameter types',
        aliases: ['demo', 'help-demo']
    )]
    public function __invoke(
        ConsoleInput $input,
        ConsoleOutput $output,
        string $name = 'World',
        int $count = 5,
        bool $verbose = false,
        ?string $email = null,
        float $ratio = 1.5
    ): ExitCode {
        $output->writeLine('🎯 Demo Help Command Executed', ConsoleColor::BRIGHT_GREEN);
        $output->writeLine(str_repeat('=', 40));

        $output->writeLine("👋 Hello, {$name}!");
        $output->writeLine("🔢 Count: {$count}");
        $output->writeLine("📊 Ratio: {$ratio}");

        if ($verbose) {
            $output->writeLine('🔍 Verbose mode enabled');
        }

        if ($email) {
            $output->writeLine("📧 Email: {$email}");
        }

        $output->writeLine('');
        $output->writeLine('💡 This command demonstrates:');
        $output->writeLine('  • String parameters with defaults');
        $output->writeLine('  • Integer parameters');
        $output->writeLine('  • Boolean flags');
        $output->writeLine('  • Optional nullable parameters');
        $output->writeLine('  • Float parameters');
        $output->writeLine('  • Auto-generated help from signatures');

        return ExitCode::SUCCESS;
    }
}
