<?php
include 'config.php';

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

// Get all bookings
$result = $conn->query("SELECT * FROM bookings ORDER BY created_at DESC LIMIT 10");

if (!$result) {
    sendResponse(false, 'Error querying bookings: ' . $conn->error);
}

$bookings = [];
while ($row = $result->fetch_assoc()) {
    $bookings[] = $row;
}

sendResponse(true, 'Found ' . count($bookings) . ' bookings', $bookings);

$conn->close();
?>
