<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;

final class RulesRegisterCommand extends AbstractCommand
{
    public function name(): string { return 'rules:register'; }
    public function description(): string { return 'PPphp Rules Register'; }

    public function handle(array $arguments = []): int
    {
        $this->title('PPphp Rules Register');
        $runtime = \PpPhp\Core\Platform\Rules\RulesRuntime::instance(\PpPhp\Core\Platform\Console\ConsolePath::basePath()); $ruleSet = $runtime->registerRuleSet(\PpPhp\Core\Platform\Rules\RuleSet::create('console_rules', 'Console Rules', [\PpPhp\Core\Platform\Rules\RuleDefinition::create('console_rule', 'Console Rule', [\PpPhp\Core\Platform\Rules\RuleCondition::create('enabled', 'equals', true)->toArray()], [\PpPhp\Core\Platform\Rules\RuleAction::create('console_action', 'setDecision', ['decision' => 'allow'])->toArray()])->toArray()])); $this->line('Registered: ' . $ruleSet->ruleSetId());
        return 0;
    }
}
