<?php
require_once 'config.php';

checkAccess(['admin', 'programmer']);

$data = json_decode(file_get_contents("php://input"), true);
try {
    $stmt = $pdo->prepare("DELETE FROM residents WHERE id = ?");
    $stmt->execute([$data['id']]);
    response(["success" => true]);
} catch (PDOException $e) {
    response(["error" => "Error al eliminar: " . $e->getMessage()], 500);
}
?>