<?php

namespace App\Helpers\Validations;

use App\Helpers\Environment\SystemFeaturesHelper;
use App\Helpers\Environment\SystemModulesHelper;

class ReportConditionHelper
{
    public static function evaluate(array $condition): bool
    {
        if (!isset($condition['helper'], $condition['element']))
            return false;

        return match ($condition['helper']) {
            'features' => SystemFeaturesHelper::getFeatureStatus($condition['element']),
            'modules'  => SystemModulesHelper::getModuleStatus($condition['element']),
            '!features' => !SystemFeaturesHelper::getFeatureStatus($condition['element']),
            '!modules'  => !SystemModulesHelper::getModuleStatus($condition['element']),
            default    => false,
        };
    }
}
