<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class ProjectionRunCommand extends AbstractCommand
{
    public function name(): string { return 'projection:run'; }
    public function description(): string { return 'PPphp Projection Run'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Projection Run');
        $runtime = \PpPhp\Core\Platform\Event\Sourcing\Projection\ProjectionRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); if (($runtime->readModel('console_projection')) === null) { $runtime->register(\PpPhp\Core\Platform\Event\Sourcing\Projection\ProjectionDefinition::create('console_projection', 'Console Projection', [], [])); } $processed = $runtime->run('console_projection'); $this->line('Processed: ' . $processed);
        return 0;
    }
}
