import { NextResponse } from "next/server"
import { auth } from "@/lib/auth"
import { markAsRead } from "@/features/notifications/service"

export async function PATCH(_req: Request, { params }: { params: Promise<{ id: string }> }) {
  const session = await auth()
  if (!session?.user?.id) return NextResponse.json({ error: "Unauthorized" }, { status: 401 })

  const { id } = await params
  await markAsRead(session.user.id, id)
  return NextResponse.json({ ok: true })
}