import { getDictionary } from "@/i18n/getDictionary";
import { getCarouselImages, getClients, getTestimonials, getBlogs } from "@/app/actions/adminData";
import { getProducts } from "@/app/actions/product";
import Hero from "@/components/Hero";
import TrustSection from "@/components/TrustSection";
import ProductCategories from "@/components/ProductCategories";
import FeaturedMachines from "@/components/FeaturedMachines";
import Industries from "@/components/Industries";
import WhyChooseUs from "@/components/WhyChooseUs";
import ClientTestimonials from "@/components/ClientTestimonials";
import BlogSection from "@/components/BlogSection";
import Contact from "@/components/Contact";

export default async function Home({ params }: { params: Promise<{ lang: string }> }) {
  const { lang } = await params;
  const dict = await getDictionary(lang as "fr" | "ar");
  
  const [carouselImages, dbProducts, clients, testimonials, blogs] = await Promise.all([
    getCarouselImages(),
    getProducts(),
    getClients(),
    getTestimonials(),
    getBlogs()
  ]);

  return (
    <div className="overflow-hidden">
      <Hero dict={dict} images={carouselImages} />
      <FeaturedMachines dict={dict} dbProducts={dbProducts} />
      <TrustSection dict={dict} clients={clients} />
      <ProductCategories dict={dict} />
      <WhyChooseUs dict={dict} />
      <Industries dict={dict} />
      <ClientTestimonials dict={dict} testimonials={testimonials} />
      <BlogSection dict={dict} blogs={blogs} />
      <Contact dict={dict} />
    </div>
  );
}
