<?php
require_once __DIR__ . '/../../connect.php';

$id = filterRequest("id");

if (empty($id)) {
    jsonError("Missing ride ID.");
    exit;
}

$sql = "SELECT `status` FROM `ride` WHERE `id` = :id";
$stmt = $con->prepare($sql);
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();

$row = $stmt->fetch(PDO::FETCH_ASSOC);

if ($row && isset($row['status'])) {
    echo json_encode([
        "status" => "success",
        "data" => $row['status']
    ]);
} else {
    jsonError("Ride not found.");
}
?>