<?php

namespace modules\selfserve\interfaces;

interface selfserve_condition_evaluator_i
{
    /**
     * @param array<int,array<string,mixed>> $conditions
     * @param array<int,array<string,mixed>> $rules
     * @param array<int,bool|null> $answers
     * @return array<int,bool>
     */
    public function evaluate(array $conditions, array $rules, array $answers): array;

    /**
     * @param array<int,array<string,mixed>> $conditions
     * @param array<int,bool|null> $answers
     * @return array<int,bool>
     */
    public function evaluateExpressions(array $conditions, array $answers): array;

    /**
     * @param array<int,array<string,mixed>> $conditions
     * @param array<int,bool|null> $answers
     * @return array{results:array<int,bool>,trace:array<int,array<string,mixed>>}
     */
    public function evaluateExpressionsWithTrace(array $conditions, array $answers): array;

    /**
     * @param int|null $gateId
     * @param array<int,bool> $conditionResults
     * @param array<int,bool|null> $answers
     * @return bool
     */
    public function taskGateSatisfied(?int $gateId, array $conditionResults, array $answers): bool;

    /**
     * @param string $gateType ALWAYS|CONDITION|QUESTION
     * @param int|null $gateRefId
     * @param array<int,bool> $conditionResults
     * @param array<int,bool|null> $answers
     * @return bool
     */
    public function taskGateSatisfiedTyped(string $gateType, ?int $gateRefId, array $conditionResults, array $answers): bool;
}
