import type { Metadata } from "next";
import { Halant } from "next/font/google";
import { Inter } from "next/font/google";
import { Nunito } 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"],
});

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

export const metadata: Metadata = {
  title: "PyLearn - Learn Python with Interactive Browser Interpreter",
  description: "Master Python programming with PyLearn's beginner-friendly platform featuring interactive tutorials, hands-on challenges, and an integrated Python interpreter. Start coding now!",
  keywords: "python programming, learn python, python interpreter, coding tutorials, beginner programming, interactive coding",
  metadataBase: new URL("https://pylearn.app"),
  alternates: {
    canonical: "https://pylearn.app",
  },
  openGraph: {
    title: "PyLearn - Learn Python Interactively",
    description: "Master Python programming with our comprehensive platform. Write code, see results instantly. Perfect for beginners!",
    url: "https://pylearn.app",
    siteName: "PyLearn",
    type: "website",
    images: [
      {
        url: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3B6sh1xZKNJYDe63NCnshCWKiPL/a-modern-code-editor-interface-displayin-1773824099697-e11e3078.png",
        alt: "PyLearn Python Learning Platform",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "PyLearn - Learn Python Interactively",
    description: "Master Python programming with browser-based interpreter and interactive lessons",
    images: [
      "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3B6sh1xZKNJYDe63NCnshCWKiPL/a-modern-code-editor-interface-displayin-1773824099697-e11e3078.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} ${nunito.variable} antialiased`}
        >
          <Tag />
          {children}
          <script
              dangerouslySetInnerHTML={{
                  __html: `${getVisualEditScript()}`
          }}
        />
        </body>
      </ServiceWrapper>
    </html>
  );
}