<?php
require 'db.php';
require 'helpers.php';
require_committee();

if (!isset($_GET['id']) || !isset($_GET['student_id'])) {
    die('Invalid request');
}

$registration_id = (int)$_GET['id'];
$student_id = $_GET['student_id'];

// Soft delete registration
$stmt = $mysqli1->prepare("UPDATE registrations SET deleted_at = NOW() WHERE id = ?");
$stmt->bind_param("i", $registration_id);

if ($stmt->execute()) {
    header('Location: student_profile_admin.php?student_id=' . urlencode($student_id) . '&success=1');
} else {
    die('Error deleting registration: ' . $mysqli1->error);
}