<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class DecisionTableRegisterCommand extends AbstractCommand
{
    public function name(): string { return 'rules:table:register'; }
    public function description(): string { return 'PPphp Decision Table Register'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Decision Table Register');
        $runtime = \PpPhp\Core\Platform\Rules\RulesRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $table = $runtime->registerDecisionTable(\PpPhp\Core\Platform\Rules\DecisionTable::create('console_decision_table', 'Console Decision Table', ['enabled'], ['decision'], [['rowId' => 'row_allow', 'conditions' => [\PpPhp\Core\Platform\Rules\RuleCondition::create('enabled', 'equals', true)->toArray()], 'outputs' => ['decision' => 'allow']]])); $this->line('Registered: ' . $table->tableId());
        return 0;
    }
}
