<?php
declare(strict_types=1);require dirname(__DIR__).'/core/bootstrap.php';
$id=(int)($_GET['duration_id']??0);$date=(string)($_GET['date']??'');
if($id<1||!valid_iso_date($date))json_response(['slots'=>[]],422);
if(!rate_limit('availability:'.client_ip(),120,60))json_response(['slots'=>[],'message'=>'Çok fazla uygunluk sorgusu yapıldı.'],429);
$pref=(string)($_GET['preference']??'no_preference');$session=(string)($_GET['session_type']??'single');
json_response(['slots'=>available_slots($id,$date,$pref,$session)]);
