<?php

declare(strict_types=1);

require_once dirname(__DIR__) . '/app/bootstrap.php';

$checks = [
    'PHP Version >= 7.2' => version_compare(PHP_VERSION, '7.2.0', '>='),
    'PDO extension' => extension_loaded('pdo'),
    'PDO OCI driver' => in_array('oci', PDO::getAvailableDrivers(), true),
    '.env exists' => is_file(dirname(__DIR__) . '/.env'),
    'storage/logs writable' => is_writable(dirname(__DIR__) . '/storage/logs'),
    'storage/cache writable' => is_writable(dirname(__DIR__) . '/storage/cache'),
];

?><!doctype html>
<html lang="ar" dir="rtl">
<head>
    <meta charset="utf-8">
    <title>Install Check</title>
    <link rel="stylesheet" href="assets/css/app.css">
</head>
<body style="padding:30px">
<section class="card">
    <h1>فحص بيئة التشغيل</h1>
    <table>
        <thead><tr><th>الفحص</th><th>النتيجة</th></tr></thead>
        <tbody>
        <?php foreach ($checks as $name => $ok): ?>
            <tr>
                <td><?= e($name) ?></td>
                <td><?= $ok ? '<span class="status-ok">OK</span>' : '<span class="pill negative">Missing</span>' ?></td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
    <p class="muted">احذف هذا الملف من الإنتاج بعد انتهاء الإعداد.</p>
</section>
</body>
</html>
