<?php
require 'middleware.php';

$stmt = $pdo->prepare("
SELECT * FROM bookings
WHERE driver_id=? 
AND status IN ('assigned','accepted','on_the_way','arrived')
ORDER BY pickup_datetime ASC
");
$stmt->execute([$driver_id]);

$jobs = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo json_encode(['jobs' => $jobs]);
