<?php

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

$title = filterRequest("title");
$body = filterRequest("body");
$passengerID = filterRequest("passenger_id");

// SQL الآمن باستخدام placeholders
$sql = "INSERT INTO `notifications` (
  `title`,
  `body`,
  `passenger_id`
) VALUES (
  :title,
  :body,
  :passengerID
)";

$stmt = $con->prepare($sql);
$stmt->execute([
    ':title' => $title,
    ':body' => $body,
    ':passengerID' => $passengerID
]);

if ($stmt->rowCount() > 0) {
    jsonSuccess(null, "Notification data saved successfully");
} else {
    jsonError("Failed to save notification data");
}

?>