<?php
require_once __DIR__ . '/../../includes/auth.php';
require_once __DIR__ . '/../../includes/database.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $usuarioId = $_POST['usuario_id'] ?? 0;
    
    if ($usuarioId) {
        global $db;
        $result = $db->update('notificaciones', ['leida' => 1], "usuario_id = ?", [$usuarioId]);
        
        if ($result) {
            echo json_encode(['success' => true]);
            exit;
        }
    }
}

echo json_encode(['success' => false]);
?>