import { NextResponse } from "next/server";
import { getPollById } from "@/lib/data";

interface RouteParams {
  params: Promise<{ id: string }>;
}

// GET /api/polls/[id] — enkele poll ophalen
export async function GET(
  request: Request,
  { params }: RouteParams
): Promise<NextResponse> {
  const { id } = await params;
  const poll = getPollById(id);

  if (!poll) {
    return NextResponse.json(
      { error: "Poll niet gevonden" },
      { status: 404 }
    );
  }

  return NextResponse.json(poll);
}
