<?php

session_start();

require_once __DIR__ . '/../core/functions.php';
require_once __DIR__ . '/../services/UserAlertService.php';

$userId = (int)($_SESSION['user_id'] ?? 0);
$alertId = (int)($_POST['alert_id'] ?? 0);

if ($userId > 0 && $alertId > 0) {
    UserAlertService::deleteAlert($alertId, $userId);
}

header('Location: my_alerts.php?deleted=1');
exit;
