<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class RuleRepositoryFindCommand extends AbstractCommand
{
    public function name(): string { return 'rules:repository:find'; }
    public function description(): string { return 'PPphp Rule Repository Find'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Rule Repository Find');
        $runtime = \PpPhp\Core\Platform\Rules\Repository\RuleRepositoryRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $entry = $runtime->registry()->latest('loan_high_value') ?? $runtime->registry()->latest('console_rule'); $this->line('Found: ' . ($entry ? 'YES' : 'NO')); if ($entry) { $this->line('Rule: ' . $entry->ruleId()); $this->line('Version: ' . $entry->version()); }
        return 0;
    }
}
