<?php
declare(strict_types=1);
namespace PpPhp\Core\Designer\Generation\Validation;
use PpPhp\Core\Designer\Generation\DesignerGenerationRuntime;
final class DesignerGenerationVerifier{public function verify():array{$rt=new DesignerGenerationRuntime();$app=$rt->generateCrudApplication('crm_app','CRM Application',['customers'=>[['name'=>'id','type'=>'number'],['name'=>'name','type'=>'text'],['name'=>'email','type'=>'email']],'orders'=>[['name'=>'id','type'=>'number'],['name'=>'customer','type'=>'text'],['name'=>'total','type'=>'currency']]]);$stats=$rt->stats($app);$manifest=$app->manifest();$plan=$rt->writePlan($app);$checks=['application'=>$app->applicationId()==='crm_app','pages'=>($stats['generatedPages']??0)>=17,'dashboard'=>($stats['dashboardPages']??0)>=1,'grid'=>($stats['gridPages']??0)>=2,'forms'=>($stats['formPages']??0)>=6,'auth'=>($stats['authPages']??0)===8,'routes'=>($stats['routes']??0)>=17,'assets'=>($stats['assets']??0)>=4,'manifest'=>($manifest['pages']??0)>=17 && ($manifest['version']??'')==='1.0.0','writePlan'=>count($plan)>=19];$issues=[];foreach($checks as $c=>$ok){if(!$ok)$issues[]=['check'=>$c,'message'=>'Designer generation verification failed: '.$c];}return ['ok'=>!in_array(false,$checks,true),'checks'=>$checks,'issues'=>$issues,'summary'=>array_replace($stats,['checks'=>count($checks),'passed'=>count(array_filter($checks)),'failed'=>count($checks)-count(array_filter($checks)),'score'=>in_array(false,$checks,true)?80:100]),'manifest'=>$manifest,'writePlan'=>$plan];}}
