import { Suspense } from "react";
import { getDictionary } from "@/lib/dictionaries";
import { Hero } from "@/components/sections/Hero";
import { Features } from "@/components/sections/Features";
import { Pricing } from "@/components/sections/Pricing";
import { FAQ } from "@/components/sections/Faq";
import { BlogPreview } from "@/components/sections/BlogPreview";

export default async function Home({
  params,
}: {
  params: Promise<{ lang: string }>;
}) {
  // РАЗВОРАЧИВАЕМ PARAMS
  const { lang } = await params;

  // Получаем словарь, используя проверенную строку
  const dict = await getDictionary(lang);

  return (
    <>
      <Hero dict={dict.hero} />
      <Features dict={dict.features} />
      <Pricing dict={dict.pricing} lang={lang} />
      <FAQ dict={dict.faq} lang={lang} />

      {
        <Suspense
          fallback={<div className="py-20 text-center">Loading...</div>}
        >
          <BlogPreview lang={lang} />
        </Suspense>
      }
    </>
  );
}
