<?php
require_once '../includes/functions.php';
requireLogin();
requireAdmin();

if (isset($_GET['id'])) {
    $id = $_GET['id'];
    // Hard delete or soft delete? Requirement says "Delete any certificate". Usually soft delete is improved for audit, but let's do soft delete as default in schema, but here let's just mark it as deleted or delete it.
    // The requirement "Certificate status (active / deleted)" implies soft delete.
    
    $stmt = $pdo->prepare("UPDATE certificates SET status = 'deleted' WHERE id = ?");
    $stmt->execute([$id]);
    
    header("Location: manage_certificates.php?msg=deleted");
    exit();
}
header("Location: manage_certificates.php");
?>
