import { NextResponse } from "next/server";
import { demoVacancies } from "@/lib/demo-data/vacancies";

export async function GET(
  request: Request,
  { params }: { params: Promise<{ slug: string }> }
) {
  const { slug } = await params;
  // In a real application, you would fetch this data from your CMS (Directus)
  const vacancy = demoVacancies.find(
    (v) => v.slug === slug && v.status === "Open"
  );

  if (!vacancy) {
    return NextResponse.json({ message: "Vacancy not found" }, { status: 404 });
  }

  return NextResponse.json(vacancy);
}
