<?php require BASE_PATH . '/app/Views/layout/header.php'; ?>
<link rel="stylesheet" href="/public/assets/css/axiom-foundation.css">

<main class="axiom-foundation">
    <section class="axiom-hero">
        <div>
            <span class="axiom-eyebrow">AXIOM PLATFORM</span>
            <h1>V8 Foundation</h1>
            <p>Le nouveau noyau s'exécute à côté de CDA V7, sans remplacer les modules métiers existants.</p>
        </div>
        <div class="axiom-version"><?= htmlspecialchars($version) ?></div>
    </section>

    <section class="axiom-grid axiom-grid-kpi">
        <article class="axiom-card"><strong><?= count($modules) ?></strong><span>modules enregistrés</span></article>
        <article class="axiom-card"><strong><?= count($entities) ?></strong><span>entités de métadonnées</span></article>
        <article class="axiom-card"><strong>V7 → V8</strong><span>compatibilité progressive</span></article>
        <article class="axiom-card"><strong>Actif</strong><span>Event Dispatcher</span></article>
    </section>

    <section class="axiom-panel">
        <div class="axiom-panel-head">
            <div><span class="axiom-eyebrow">NOYAU</span><h2>Composants Foundation</h2></div>
            <a class="axiom-button" href="/public/administration/fondation/diagnostic" target="_blank" rel="noopener">Diagnostic JSON</a>
        </div>
        <div class="axiom-component-grid">
            <?php foreach (['Application Kernel','Service Container','Configuration Repository','Event Dispatcher','Module Registry','Metadata Registry','Compatibility Bridge','Health Report'] as $component): ?>
                <div class="axiom-component"><span class="axiom-dot"></span><?= htmlspecialchars($component) ?></div>
            <?php endforeach; ?>
        </div>
    </section>

    <section class="axiom-panel">
        <span class="axiom-eyebrow">REGISTRE</span>
        <h2>Modules reconnus</h2>
        <div class="axiom-table-wrap">
            <table class="axiom-table">
                <thead><tr><th>Code</th><th>Module</th><th>Version</th><th>Statut</th></tr></thead>
                <tbody>
                <?php foreach ($modules as $module): ?>
                    <tr>
                        <td><code><?= htmlspecialchars((string)$module['code']) ?></code></td>
                        <td><?= htmlspecialchars((string)$module['name']) ?></td>
                        <td><?= htmlspecialchars((string)$module['version']) ?></td>
                        <td><span class="axiom-badge <?= !empty($module['legacy']) ? 'is-legacy' : 'is-v8' ?>"><?= !empty($module['legacy']) ? 'Compatibilité V7' : 'Natif V8' ?></span></td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </section>

    <section class="axiom-panel">
        <span class="axiom-eyebrow">MÉTADONNÉES</span>
        <h2>Premiers objets communs</h2>
        <div class="axiom-grid">
            <?php foreach ($entities as $entity): ?>
                <article class="axiom-entity">
                    <h3><?= htmlspecialchars((string)$entity['label']) ?></h3>
                    <code><?= htmlspecialchars((string)$entity['code']) ?></code>
                    <p><?= !empty($entity['searchable']) ? 'Indexable par le futur Search Engine.' : 'Non indexé.' ?></p>
                </article>
            <?php endforeach; ?>
        </div>
    </section>
</main>

<script src="/public/assets/js/axiom-foundation.js"></script>
<?php require BASE_PATH . '/app/Views/layout/footer.php'; ?>
