import type { Metadata } from "next";
import { Halant } from "next/font/google";
import { Inter } from "next/font/google";
import "./globals.css";
import { ServiceWrapper } from "@/components/ServiceWrapper";
import Tag from "@/tag/Tag";
import { getVisualEditScript } from "@/utils/visual-edit-script";

const halant = Halant({
  variable: "--font-halant",
  subsets: ["latin"],
  weight: ["300", "400", "500", "600", "700"],
});

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

export const metadata: Metadata = {
  title: "WordMaster - AI Language Learning Platform | Learn by Reading",
  description: "Master languages by reading real content. WordMaster combines AI translation, spaced repetition, and intelligent tutoring. Learn 7 languages with 10,000+ words. Start free today.",
  keywords: ["language learning", "AI tutor", "spaced repetition", "vocabulary learning", "translation", "multilingual", "education"],
  metadataBase: new URL("https://wordmaster.com"),
  alternates: {
    canonical: "https://wordmaster.com",
  },
  openGraph: {
    title: "WordMaster - AI Language Learning Platform",
    description: "Learn languages naturally while reading real content. AI-powered translation, spaced repetition, and tutoring.",
    url: "https://wordmaster.com",
    siteName: "WordMaster",
    type: "website",
    images: [
      {
        url: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3BAhaIpFAYLNzimScpNmULHDHVq/a-modern-clean-ai-language-learning-dash-1773938106783-7d434a23.png",
        alt: "WordMaster AI language learning platform dashboard",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "WordMaster - Learn Languages Through Real Content",
    description: "AI-powered translation and spaced repetition for natural language acquisition.",
    images: ["https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3BAhaIpFAYLNzimScpNmULHDHVq/a-modern-clean-ai-language-learning-dash-1773938106783-7d434a23.png"],
  },
  robots: {
    index: true,
    follow: true,
  },
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <ServiceWrapper>
        <body
          className={`${halant.variable} ${inter.variable} antialiased`}
        >
          <Tag />
          {children}
          <script
              dangerouslySetInnerHTML={{
                  __html: `${getVisualEditScript()}`
          }}
        />
        </body>
      </ServiceWrapper>
    </html>
  );
}