import type { Metadata } from "next";
import { Public_Sans } from "next/font/google";
import "./globals.css";
import "@/lib/gsap-setup";
import { ServiceWrapper } from "@/components/ServiceWrapper";
import Tag from "@/tag/Tag";
import { getVisualEditScript } from "@/utils/visual-edit-script";
import { i18n } from '@/lib/i18nConfig'; // New import

export const metadata: Metadata = {
  title: 'Enkidu Soft - Engineering Excellence',
  description: 'Enkidu Soft partners with enterprise leaders to architect, build, and scale transformative software solutions with rigorous engineering and deep market insight.',
  openGraph: {
    "title": "Enkidu Soft - Engineering Excellence",    "description": "Enkidu Soft partners with enterprise leaders to architect, build, and scale transformative software solutions with rigorous engineering and deep market insight.",    "url": "https://www.enkidusoft.com/en",    "siteName": "Enkidu Soft",    "images": [
      {
        "url": "http://img.b2bpic.net/free-photo/geometric-abstract-background-technology-concept-connecting-dots-design_53876-153353.jpg",        "alt": "Abstract data flow and secure connections"
      }
    ],
    "type": "website"
  },
  twitter: {
    "card": "summary_large_image",    "title": "Enkidu Soft - Engineering Excellence",    "description": "Enkidu Soft partners with enterprise leaders to architect, build, and scale transformative software solutions with rigorous engineering and deep market insight.",    "images": [
      "http://img.b2bpic.net/free-photo/geometric-abstract-background-technology-concept-connecting-dots-design_53876-153353.jpg"
    ]
  },
  robots: {
    "index": true,
    "follow": true
  },
};

const publicSans = Public_Sans({
  variable: "--font-public-sans",  subsets: ["latin"],
});

// Generate static params for all locales
export function generateStaticParams() {
  return i18n.locales.map((locale) => ({ locale }));
}

export default function RootLayout({
  children,
  params: { locale }, // Accept locale from the URL
}: Readonly<{
  children: React.ReactNode;
  params: { locale: string }; // Type definition for params
}>) {
  return (
    <html lang={locale} dir={locale === 'ar' ? 'rtl' : 'ltr'} suppressHydrationWarning>
      <ServiceWrapper>
        <body className={`${publicSans.variable} antialiased`}>
          <Tag />
          {children}
          <script
              dangerouslySetInnerHTML={{
                  __html: `${getVisualEditScript()}`
              }}
          />
        </body>
      </ServiceWrapper>
    </html>
  );
}
