<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class DecisionTablesCommand extends AbstractCommand
{
    public function name(): string { return 'rules:tables'; }
    public function description(): string { return 'PPphp Decision Tables'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Decision Tables');
        $runtime = \PpPhp\Core\Platform\Rules\RulesRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); foreach ($runtime->summary()['decisionTables'] as $table) { $this->line('- ' . $table['tableId'] . ' rows=' . count($table['rows']) . ' hitPolicy=' . $table['hitPolicy']); }
        return 0;
    }
}
