import { Navigation } from "@/components/landing/navigation";
import { HeroSection } from "@/components/landing/hero-section";
import { FeaturesSection } from "@/components/landing/features-section";
import { HowItWorksSection } from "@/components/landing/how-it-works-section";
import { InfrastructureSection } from "@/components/landing/infrastructure-section";
import { MetricsSection } from "@/components/landing/metrics-section";
import { IntegrationsSection } from "@/components/landing/integrations-section";
import { SecuritySection } from "@/components/landing/security-section";
import { DevelopersSection } from "@/components/landing/developers-section";
import { TeamSection } from "@/components/landing/team-section";
import { TestimonialsSection } from "@/components/landing/testimonials-section";
import { PricingSection } from "@/components/landing/pricing-section";
import { CtaSection } from "@/components/landing/cta-section";
import { FooterSection } from "@/components/landing/footer-section";
import { fetchPageData } from "@/lib/api";

/**
 * Server component — fetches all CMS data once per request (ISR revalidate 60s).
 * Passes data as props to sections that use it.
 * Sections that are purely design/animation keep their own hardcoded defaults.
 */
export default async function Home() {
  const pageData = await fetchPageData();

  return (
    <main className="relative min-h-screen overflow-x-hidden">
      <Navigation settings={pageData?.settings ?? null} />
      <HeroSection hero={pageData?.hero ?? null} />
      <FeaturesSection services={pageData?.services ?? null} sections={pageData?.sections ?? null} />
      <HowItWorksSection processSteps={pageData?.process_steps ?? null} sections={pageData?.sections ?? null} />
      <InfrastructureSection expertise={pageData?.expertise ?? null} sections={pageData?.sections ?? null} />
      <MetricsSection stats={pageData?.stats ?? null} sections={pageData?.sections ?? null} />
      <IntegrationsSection techStack={pageData?.tech_stack ?? null} sections={pageData?.sections ?? null} />
      <SecuritySection quality={pageData?.quality ?? null} />
      <DevelopersSection projects={pageData?.projects ?? null} sections={pageData?.sections ?? null} />
      <TeamSection team={pageData?.team ?? null} />
      <TestimonialsSection testimonials={pageData?.testimonials ?? null} sections={pageData?.sections ?? null} />
      <PricingSection plans={pageData?.pricing ?? null} sections={pageData?.sections ?? null} />
      <CtaSection sections={pageData?.sections ?? null} settings={pageData?.settings ?? null} />
      <FooterSection settings={pageData?.settings ?? null} sections={pageData?.sections ?? null} />
    </main>
  );
}
