---
import InfoPageSections from "../../../components/InfoPageSections.astro";
import SiteLayout from "../../../layouts/SiteLayout.astro";
import { getEventNavItems } from "../../../data/eventNav";
import { getEventBasePath, getEventByParams } from "../../../data/events";
import { infoPages } from "../../../data/info";

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

  if (!event) return [];

  return infoPages.map((page) => ({
    params: { infoSlug: page.slug },
    props: { event, page },
  }));
}

const { event, page } = Astro.props;

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

const eventTitle = event.shortTitle ?? event.title;
const basePath = getEventBasePath(event);
---

<SiteLayout
  title={`${page.title} - ${eventTitle}`}
  description={page.title}
  theme={event.theme ?? "default"}
  brandHref={basePath}
  brandTitle={eventTitle}
  brandSubtitle="Event home"
  navItems={getEventNavItems(event)}
  accessPassword={event.accessPassword}
>
  <section class="event-page-heading">
    <nav class="event-breadcrumb" aria-label="Event breadcrumb">
      <a href={basePath}>{eventTitle}</a>
      <span aria-hidden="true">/</span>
      <span>Information</span>
      <span aria-hidden="true">/</span>
      <span>{page.title}</span>
    </nav>
    <p class="eyebrow">Information</p>
    <h1>{page.title}</h1>
  </section>

  <div class="event-shell event-shell--single">
    <div class="event-content">
      <InfoPageSections page={page} />
    </div>
  </div>
</SiteLayout>
