<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class DistributedWorkersRegisterCommand extends AbstractCommand
{
    public function name(): string { return 'distributed:workers:register'; }
    public function description(): string { return 'PPphp Distributed Worker Register'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Distributed Worker Register');
        $coordinator = \PpPhp\Core\Platform\Event\Distributed\DistributedRuntimeCoordinator::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $record = $coordinator->registerWorker('distributed_console_worker', 'console_node', 1); $this->line('Registered: ' . $record->nodeId() . '/' . $record->workerId());
        return 0;
    }
}
