<?php
include 'includes/auth.php';
include 'db.php';

// Get check-in ID from GET parameter
$checkin_id = intval($_GET['checkin_id'] ?? 0);

if(!$checkin_id){
    echo "<script>alert('Invalid check-in ID'); window.location='kitchen.php';</script>";
    exit;
}

// Update breakfast_prepared status to 1 (prepared)
$conn->query("UPDATE stays SET breakfast_prepared = 1 WHERE id = $checkin_id");

// Optional: you can also log the time the breakfast was prepared
$conn->query("UPDATE stays SET breakfast_prepared_at = NOW() WHERE id = $checkin_id");

echo "<script>alert('✅ Breakfast marked as prepared'); window.location='kitchen.php';</script>";
exit;
?>
