<?php
/**
 * Shift Rotation API
 * Returns current, tomorrow, and day-after shifts.
 */
require_once __DIR__ . '/../config/auth.php';
requireLogin();

$date = $_GET['date'] ?? null;

if ($date) {
    // Single date query
    $shift = getShiftForDate($date);
    $shift['date'] = $date;
    jsonResponse($shift);
} else {
    // Return upcoming 3 days (default)
    jsonResponse(['shifts' => getUpcomingShifts()]);
}
