---
import EventPage from "../../components/EventPage.astro";
import { getEventByParams, getEventPageEntries } from "../../data/events";

export function getStaticPaths() {
  const event = getEventByParams("2026", "ncert");

  if (!event) return [];

  return getEventPageEntries(event)
    .filter((pageEntry) => pageEntry.type !== "overview")
    .map((pageEntry) => ({
      params: { page: pageEntry.id },
      props: { event, pageEntry },
    }));
}

const { event, pageEntry } = Astro.props;

if (!event || !pageEntry) {
  return Astro.redirect("/ncert/");
}
---

<EventPage event={event} pageEntry={pageEntry} />
