import { ReactNode } from "react";
import { notFound } from "next/navigation";
import { getMessages } from "@/lib/i18n/i18n";
import { Raleway } from "next/font/google";
import ClientLayout from "@/components/ClientLayout/ClientLayout";

const raleway = Raleway({
  subsets: ["latin"],
  variable: "--font-raleway",
}); 

export default async function RootLayout({
  children,
  params,
}: {
  children: ReactNode;
  params: { locale: string };
}) {
  const messages = await getMessages(params.locale);
  if (!messages) notFound();

  return (
    <html lang={params.locale} className={raleway.className}>
      <body>
        <ClientLayout locale={params.locale} messages={messages}>
          {children}
        </ClientLayout>
      </body>
    </html>
  );
}
