import type { Metadata } from "next";
import { Halant } from "next/font/google";
import { Inter } from "next/font/google";
import { Manrope } 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 manrope = Manrope({
  variable: "--font-manrope",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "OpusClip - Free AI Video Clipping & Content Repurposing Platform",
  description: "Transform long-form videos into viral clips with AI-powered highlights, smart captions, and direct posting to YouTube & Instagram. Completely free, no paywalls. Used by 500K+ creators worldwide.",
  keywords: "video clipping, AI video editing, content repurposing, YouTube automation, Instagram posting, video captions, social media tool, free video editor",
  metadataBase: new URL("https://opusclip.example.com"),
  alternates: {
    canonical: "https://opusclip.example.com",
  },
  openGraph: {
    title: "OpusClip - Free Video Clipping Platform",
    description: "AI-powered video clipping with instant social media posting. Free forever, no subscriptions.",
    url: "https://opusclip.example.com",
    siteName: "OpusClip",
    type: "website",
    images: [
      {
        url: "https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3BF8nYLAeDcNMjxCzQZn47kydbi/a-modern-sleek-video-editing-dashboard-i-1774159923054-24485574.png",
        alt: "OpusClip Video Clipping Dashboard",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "OpusClip - Free AI Video Clipping",
    description: "Transform videos into viral clips instantly. Free forever.",
    images: ["https://webuild-dev.s3.eu-north-1.amazonaws.com/users/user_3BF8nYLAeDcNMjxCzQZn47kydbi/a-modern-sleek-video-editing-dashboard-i-1774159923054-24485574.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} ${manrope.variable} antialiased`}
        >
          <Tag />
          {children}
          <script
              dangerouslySetInnerHTML={{
                  __html: `${getVisualEditScript()}`
          }}
        />
        </body>
      </ServiceWrapper>
    </html>
  );
}