<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class SnapshotLatestCommand extends AbstractCommand
{
    public function name(): string { return 'snapshot:latest'; }
    public function description(): string { return 'PPphp Snapshot Latest'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Snapshot Latest');
        $snapshot = \PpPhp\Core\Platform\Event\Sourcing\Snapshot\SnapshotRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath())->latest('console-aggregate'); if ($snapshot === null) { $this->line('Snapshot: NONE'); return 0; } $this->line('Snapshot: ' . $snapshot->snapshotId()); $this->line('Aggregate: ' . $snapshot->aggregateId()); $this->line('Version: ' . $snapshot->version());
        return 0;
    }
}
