<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class ProjectionCheckpointCommand extends AbstractCommand
{
    public function name(): string { return 'projection:checkpoint'; }
    public function description(): string { return 'PPphp Projection Checkpoint'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Projection Checkpoint');
        $checkpoint = \PpPhp\Core\Platform\Event\Sourcing\Projection\ProjectionRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath())->checkpoint('console_projection'); if ($checkpoint === null) { $this->line('Checkpoint: NONE'); return 0; } $this->line('Projection: ' . $checkpoint->projectionId()); $this->line('Last Sequence: ' . $checkpoint->lastSequence()); $this->line('Processed: ' . $checkpoint->processed());
        return 0;
    }
}
