import { Navbar } from "@/components/navbar";
import { Footer } from "@/components/footer";
import { Breadcrumbs } from "@/components/ui/Breadcrumbs";
import { ScrollToTop } from "@/components/ScrollToTop";
import { getOrganizationSchema, getWebSiteSchema } from "@/lib/schemas";
import "./globals.css";
import Script from "next/script";

export const metadata = {
  metadataBase: new URL("https://trainsofrajbari.com"),
  title: {
    default: "Trains of Rajbari | রাজবাড়ীর ট্রেন - Railway Schedule & Updates",
    template: "%s | Trains of Rajbari",
  },
  description:
    "Complete railway guide for Rajbari district - Train schedules, station info, Dhaka to Rajbari routes, ticket booking & real-time updates. রাজবাড়ী জেলার সম্পূর্ণ রেলওয়ে গাইড।",
  keywords: [
    "Trains of Rajbari",
    "রাজবাড়ীর ট্রেন",
    "Rajbari train schedule",
    "Dhaka to Rajbari train",
    "Rajbari to Dhaka train",
    "Bangladesh Railway",
    "train schedule",
    "রাজবাড়ী ট্রেনের সময়সূচী",
    "Sundarban Express",
    "Benapole Express",
    "Rajbari Railway Station",
    "Pangsha Railway Station",
  ],
  authors: [{ name: "Trains of Rajbari" }],
  creator: "Trains of Rajbari",
  publisher: "Trains of Rajbari",
  formatDetection: {
    email: false,
    address: false,
    telephone: false,
  },
  openGraph: {
    type: "website",
    locale: "en_US",
    url: "https://trainsofrajbari.com",
    siteName: "Trains of Rajbari",
    title: "Trains of Rajbari | রাজবাড়ীর ট্রেন - Railway Schedule & Updates",
    description:
      "Complete railway guide for Rajbari district with train schedules, station info, and real-time updates.",
    images: [
      {
        url: "/logo.png",
        width: 1200,
        height: 630,
        alt: "Trains of Rajbari",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: "Trains of Rajbari | রাজবাড়ীর ট্রেন",
    description:
      "Complete railway guide for Rajbari district with train schedules, station info, and real-time updates.",
    images: ["/logo.png"],
  },
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      "max-video-preview": -1,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
  alternates: {
    canonical: "https://trainsofrajbari.com",
  },
  verification: {
    google: "your-google-verification-code",
  },
};

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <head>
        {/* Google Analytics */}
        <Script
          src="https://www.googletagmanager.com/gtag/js?id=G-83EZC1EZ2G"
          strategy="afterInteractive"
        />
        <Script id="google-analytics" strategy="afterInteractive">
          {`
            window.dataLayer = window.dataLayer || [];
            function gtag(){dataLayer.push(arguments);}
            gtag('js', new Date());
            gtag('config', 'G-83EZC1EZ2G');
          `}
        </Script>

        {/* Organization Schema */}
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify(getOrganizationSchema()),
          }}
        />

        {/* WebSite Schema */}
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify(getWebSiteSchema()),
          }}
        />
      </head>
      <body className="min-h-screen text-foreground font-sans antialiased flex flex-col">
        <ScrollToTop />
        <Navbar />
        <Breadcrumbs />
        <main className="flex-1">{children}</main>
        <Footer />
      </body>
    </html>
  );
}
