<?php
session_start();
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");

include_once '../config/database.php';
include_once '../objects/reservation.php';

date_default_timezone_set('Asia/Bangkok');

$database = new Database();
$db = $database->getConnection();

$reservation = new Reservation($db);

$arrival = $reservation->getArrival();
$departure = $reservation->getDeparture();
// $totalReserve = $validate->getTotalReserveRoomCount();
// $totalConfirm = $validate->getTotalConfirmRoomCount();

// Simplified vacant room count calculation
// $vacantRoomCount = $totalRooms - ($totalCheckIn + $totalReserve + $totalConfirm);

$arr = array(
    "arrival" => $arrival,
    "departure" => $departure,
    // "confirm_room_count" => number_format($totalConfirm),
    // "vacant_room_count" => number_format($vacantRoomCount)
);

echo json_encode($arr);

?>
