<?php
require __DIR__ . '/_bootstrap.php';

$machineId = input('machine_id');
$id        = input('notification_id');

if ($machineId === '' || $id === '') {
    respond(['success' => false, 'message' => 'Missing machine_id or notification_id'], 400);
}

$stmt = db()->prepare('INSERT OR IGNORE INTO notification_reads (notification_id, machine_id) VALUES (?, ?)');
$stmt->execute([(string) $id, $machineId]);

respond(['success' => true]);
