<?php
include_once __DIR__ . '/api-bootstrap.php';

// Simple connectivity & environment diagnostic
api_require_login();

$hasBreakfastColumn = false;
try {
    $res = mysqli_query($con, "SHOW COLUMNS FROM tblbookings LIKE 'ComplimentaryBreakfast'");
    if ($res && mysqli_num_rows($res) === 1) {
        $hasBreakfastColumn = true;
    }
} catch (Throwable $e) {
    // Ignore, will report below
}

api_json([
    'success' => true,
    'message' => 'API ping OK',
    'timestamp' => date('c'),
    'user_id' => $_SESSION['uid'] ?? null,
    'environment' => [
        'php_version' => PHP_VERSION,
        'display_errors' => ini_get('display_errors'),
        'error_reporting' => error_reporting(),
        'mysql_client_info' => mysqli_get_client_info(),
    ],
    'schema' => [
        'complimentary_breakfast_column' => $hasBreakfastColumn,
    ]
]);
