<?php
require_once 'db/config.php';

header('Content-Type: application/json');

$response = [
    'status' => 'ok',
    'timestamp' => time(),
    'php_version' => PHP_VERSION,
    'database' => 'unknown'
];

try {
    $db = db();
    $db->query('SELECT 1');
    $response['database'] = 'connected';
} catch (Exception $e) {
    $response['status'] = 'error';
    $response['database'] = 'error: ' . $e->getMessage();
}

echo json_encode($response);
