import SiteHeader from "./components/SiteHeader";
import HeroSection from "./components/HeroSection";
import GedFeature from "./components/GedFeature";
import AboutSection from "./components/AboutSection";
import ProgramsSection from "./components/ProgramsSection";
import PartnersSection from "./components/PartnersSection";
import BlogsSection from "./components/BlogsSection";
import SiteFooter from "./components/SiteFooter";
import { getFullHomepageContent } from "@/app/lib/content";

export const dynamic = "force-dynamic";

export default async function Home() {
  const content = await getFullHomepageContent();

  const sectionMap: Record<string, React.ReactNode> = {
    hero: (
      <HeroSection
        key="hero"
        content={content.hero}
        slides={content.heroSlides}
      />
    ),
    ged: <GedFeature key="ged" content={content.ged} />,
    about: <AboutSection key="about" content={content.about} />,
    programs: (
      <ProgramsSection
        key="programs"
        section={content.programsSection}
        programs={content.programs}
      />
    ),
    partners: (
      <PartnersSection
        key="partners"
        section={content.partnersSection}
        partners={content.partners}
      />
    ),
    blogs: (
      <BlogsSection
        key="blogs"
        section={content.blogsSection}
        posts={content.posts}
      />
    ),
  };

  return (
    <div className="min-h-screen bg-white font-sans text-[#222]">
      <SiteHeader />
      {content.sections.map((section) => sectionMap[section.key] ?? null)}
      <SiteFooter />
    </div>
  );
}
