<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class StreamTopicsCommand extends AbstractCommand
{
    public function name(): string { return 'stream:topics'; }
    public function description(): string { return 'PPphp Stream Topics'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Stream Topics');
        $bus = \PpPhp\Core\Platform\Event\Streaming\MessageBus::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); foreach ($bus->summary()['topics'] as $topic) { $this->line('- ' . $topic['name'] . ' status=' . $topic['status'] . ' priority=' . $topic['priority']); }
        return 0;
    }
}
