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

$kazan = filterRequest("kazan");
$adminId = filterRequest("adminId");
$latePrice = filterRequest("latePrice");
$heavyPrice = filterRequest("heavyPrice");
$naturePrice = filterRequest("naturePrice");
$comfortPrice = filterRequest("comfortPrice");
$speedPrice = filterRequest("speedPrice");
$deliveryPrice = filterRequest("deliveryPrice");
$freePrice = filterRequest("freePrice");
$country = filterRequest("country");
$fuelPrice = filterRequest("fuelPrice");

// Prepare an SQL statement with placeholders for the values
$sql = "INSERT INTO `kazan`( `country`,`kazan`, `comfortPrice`, `speedPrice`, `deliveryPrice`, `freePrice`, `latePrice`, `heavyPrice`, `adminId`, `naturePrice`, `fuelPrice`) VALUES (:country,:kazan, :comfortPrice, :speedPrice, :deliveryPrice, :freePrice, :latePrice, :heavyPrice, :adminId, :naturePrice,:fuelPrice)";

$stmt = $con->prepare($sql);

// Bind the parameters to the SQL query
$stmt->bindParam(':kazan', $kazan);
$stmt->bindParam(':comfortPrice', $comfortPrice);
$stmt->bindParam(':speedPrice', $speedPrice);
$stmt->bindParam(':deliveryPrice', $deliveryPrice);
$stmt->bindParam(':freePrice', $freePrice);
$stmt->bindParam(':latePrice', $latePrice);
$stmt->bindParam(':heavyPrice', $heavyPrice);
$stmt->bindParam(':adminId', $adminId);
$stmt->bindParam(':naturePrice', $naturePrice);
$stmt->bindParam(':country', $country);
$stmt->bindParam(':fuelPrice', $fuelPrice);

// Execute the statement
if ($stmt->execute()) {
    // Print a success message
    jsonSuccess(null, "Kazan saved successfully");
} else {
    // Print a failure message
    jsonError("Failed to save Kazan");
}

// Close the statement
$stmt->close();
?>
