<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class EventStoreArchiveCommand extends AbstractCommand
{
    public function name(): string { return 'eventstore:archive'; }
    public function description(): string { return 'PPphp Event Store Archive'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Event Store Archive');
        $summary = \PpPhp\Core\Platform\Event\Sourcing\Compaction\EventCompactionRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath())->summary(); $this->line('Archives: ' . count($summary['archives'])); $this->line('Archived Events: ' . ($summary['statistics']['archivedEvents'] ?? 0));
        return 0;
    }
}
