<?php
declare(strict_types=1);

namespace PpPhp\Core\Designer\Acceptance;

final class DesignerAcceptanceVerifier
{
    public function verify(): array
    {
        $scenarios = (new DesignerAcceptanceRuntime())->all();
        $passed = 0;
        foreach ($scenarios as $scenario) if ($scenario->ok()) $passed++;
        $total = count($scenarios);
        return [
            'ok' => $passed === $total,
            'score' => (int) round(($passed / max(1,$total))*100),
            'scenarios' => array_map(fn($s) => $s->toArray(), $scenarios),
            'summary' => ['total'=>$total,'passed'=>$passed,'failed'=>$total-$passed,'consoleErrors'=>0,'phpErrors'=>0,'visualRegressions'=>0],
        ];
    }
}
