import Header from '@/components/layout/header';
import ModalLanguageSelector from '@/components/layout/languageModal';
import AboutTopInfo from '@/components/pages/about/TopInfo';
import HomePageBlog from '@/components/pages/home/HomePageBlog';
import HomeStorySection from '@/components/pages/home/HomeStorySection';
import HomePageProducts from '@/components/pages/home/Products';
import HomePageProjects from '@/components/pages/home/Projects';
import type { IPageParams } from '@/models/layout.d';
import { getTranslations, setRequestLocale } from 'next-intl/server';

export async function generateMetadata({ params }: { params: IPageParams }) {
  const { locale } = await params;
  setRequestLocale(locale);
  const t = await getTranslations({ locale });

  return {
    title: t('page_home_metadata_title'),
    description: t('page_home_metadata_description'),
  };
}
export default async function Home({ params }: { params: IPageParams }) {
  const { locale } = await params;

  await getTranslations({ locale });
  const t = await getTranslations({ locale });
  return (
    <main className="flex flex-col items-center justify-between">
      <ModalLanguageSelector />
      <Header />
      <AboutTopInfo />
      <HomePageProducts locale={locale} />
      <HomePageProjects locale={locale} />
      <HomeStorySection className="my-12 lg:my-24" />
      <HomePageBlog locale={locale} className="my-12 lg:my-24" />
    </main>
  );
}
