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

$deviceNumber = filterRequest("deviceNumber"); // Assuming you'll get deviceNumber as input
$name = filterRequest("name");

$sql = "INSERT INTO `adminUser`(`id`, `device_number`, `name`) VALUES (
  UUID(),
  :deviceNumber,
  :name
)";

$stmt = $con->prepare($sql);
$stmt->bindParam(':deviceNumber', $deviceNumber);
$stmt->bindParam(':name', $name);
$stmt->execute();

if ($stmt->rowCount() > 0) {
  // Print a success message
  jsonSuccess($message = "Admin user data saved successfully");
} else {
  // Print a failure message
  jsonError($message = "Failed to save admin user data");
}
?>
