<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class QueryFilterCommand extends AbstractCommand
{
    public function name(): string { return 'query:filter'; }
    public function description(): string { return 'PPphp Query Filter'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Query Filter');
        $runtime = \PpPhp\Core\Platform\Event\Sourcing\Query\QueryRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $runtime->register(\PpPhp\Core\Platform\Event\Sourcing\Query\ReadModelDefinition::create('console_read_model', 'console_projection', 'Console Read Model', ['aggregateId', 'state'])); $result = $runtime->query(\PpPhp\Core\Platform\Event\Sourcing\Query\QueryRequest::create('console_read_model', ['aggregateId' => 'console-aggregate'], 'aggregateId', 'asc', 1, 10)); $this->line('Filtered: ' . $result->returned());
        return 0;
    }
}
