import { Metadata } from "next";
import { getLocale, getTranslations } from "next-intl/server";
import { Hero } from "./_components/hero";
import { DependencesSwiper } from "./_components/dependences-swiper";
import { ClientsSwiper } from "./_components/clients-swiper";

export const generateMetadata = async (): Promise<Metadata> => {
  const t = await getTranslations();
  const locale = await getLocale();

  const siteName = locale === 'ar' ? "منصة مواهب للتعليم والتدريب المعتمد" : "Mwaheb Training & Education Center";
  
  const title = locale === 'ar' 
    ? "الصفحة الرئيسية | منصة مواهب للتعليم والتدريب" 
    : "Home | Mwaheb Training & Education Center";

  const description = locale === 'ar'
    ? "سجل الآن في منصة مواهب للتعليم والتدريب الإلكتروني. منصة التدريب الرائدة لتطوير مهاراتك التقنية والمهنية والشخصية مع برامج وباقات معتمدة لتسريع مسيرتك المهنية."
    : "Join Mwaheb Training & Education Center today. Discover leading certified training programs, exclusive packages, and remote courses designed to boost your professional skills.";

  const keywords = locale === 'ar'
    ? ["منصة مواهب", "مواهب للتدريب", "دورات معتمدة", "تعليم الكتروني", "باقات تدريبية", "المملكة العربية السعودية"]
    : ["Mwaheb Platform", "Mwaheb Training", "certified courses", "e-learning", "training packages", "Saudi Arabia"];

  return {
    title,
    description,
    keywords,
    metadataBase: new URL("https://next.ivorytraining.com"),
    alternates: {
      canonical: `https://next.ivorytraining.com/${locale}`,
      languages: {
        'ar': 'https://next.ivorytraining.com/ar',
        'en': 'https://next.ivorytraining.com/en',
        'x-default': 'https://next.ivorytraining.com/ar'
      }
    },
    openGraph: {
      title,
      description,
      url: `https://next.ivorytraining.com/${locale}`,
      siteName,
      type: "website",
      locale: locale === 'ar' ? 'ar_SA' : 'en_US',
      images: [
        {
          url: "https://next.ivorytraining.com/images/logo.png",
          width: 800,
          height: 600,
          alt: siteName,
        }
      ]
    },
    twitter: {
      card: "summary_large_image",
      title,
      description,
      images: ["https://next.ivorytraining.com/images/logo.png"],
    },
    robots: {
      index: true,
      follow: true,
      googleBot: {
        index: true,
        follow: true,
        'max-video-preview': -1,
        'max-image-preview': 'large',
        'max-snippet': -1,
      },
    }
  };
};

export default function LocaleHome() {
  return (
    <main className="flex flex-col items-center justify-center bg-white">
      <main className="box w-full">
        <Hero />
      </main>
      <ClientsSwiper />
      <DependencesSwiper />
    </main>
  );
}
