import { NextResponse } from 'next/server';

import { withAuth } from '@/lib/api/helpers';
import { acknowledgeAlert } from '@/lib/services/alerts.service';

export const POST = withAuth(async (_req, ctx, params) => {
  const id = params.id;
  if (!id) return NextResponse.json({ error: 'Missing id' }, { status: 400 });
  await acknowledgeAlert(id, ctx.userId);
  return NextResponse.json({ ok: true });
});
