<?php
declare(strict_types=1);
require_once __DIR__.'/BaseHandler.php';
final class RuntimeConfigHandler extends BaseHandler
{
    public function handle(): void
    {
        $this->requireMethod('GET');
        $userId=(string)($this->user['id']??'');
        $keys=['experimental_ui','smart_notifications','maintenance_guard'];
        $flags=[];foreach($keys as $k)$flags[$k]=function_exists('itz_feature')?itz_feature($k,false,$userId):false;
        $modules=[];$v=\iTz\V7\Kernel::instance();if($v){foreach($v->modules() as $id=>$m)$modules[$id]=['name'=>$m['name'],'version'=>$m['version']];}
        AYCoreResponse::ok(['edition'=>'V7 Architect','version'=>defined('AYCORE_VERSION')?AYCORE_VERSION:'7.0.0','flags'=>$flags,'modules'=>$modules]);
    }
}
