<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Event\Runtime\EventRuntimeRegistry;

final class ListenersCommand extends AbstractCommand
{
    public function name(): string { return 'listeners'; }
    public function description(): string { return 'Show listener registry overview.'; }

    public function handle(array $arguments = []): int
    {
        $runtime = new EventRuntimeRegistry();

        $this->title('PPphp Listener Registry');
        $summary = $runtime->summary();
        $this->line('Events: ' . $summary['events']);
        $this->line('Listeners: ' . $summary['listeners']);
        $this->line('Status: OK');
        return 0;
    }
}
