import NavigationWrapper from "@/components/NavigationWrapper";
import HeroSection from "@/components/HeroSection";
import EventsSection from "@/components/EventsSection";
import { prisma } from "@/lib/prisma";

export default async function Home() {
  const events = await prisma.event.findMany({
    orderBy: {
      date: "asc",
    },
    take: 3,
  });

  // Convert Date objects to strings for serialization
  const serializedEvents = events.map((event) => ({
    ...event,
    date: event.date.toISOString(),
  }));

  return (
    <main className="min-h-screen bg-black relative">
      <NavigationWrapper />
      <HeroSection />
      <EventsSection events={serializedEvents} />
    </main>
  );
}
