<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Workflow\Bpmn;

final class BpmnRuntimeStatistics
{
    public static function from(array $models, array $designers, array $imports, array $exports): array
    {
        $elements = 0;
        $flows = 0;

        foreach ($models as $model) {
            $elements += count((array) ($model['elements'] ?? []));
            $flows += count((array) ($model['flows'] ?? []));
        }

        return [
            'models' => count($models),
            'designerModels' => count($designers),
            'imports' => count($imports),
            'exports' => count($exports),
            'elements' => $elements,
            'flows' => $flows,
        ];
    }
}
