import React from "react";
import Navbar from "../components/Common/Navbar";
import Footer from "../components/Common/Footer";
import BackToTop from "../components/BackToTop";
import AIChatbot from "../components/AIChatbot";
import "../app/styles/bootstrap.min.css";
import "../app/styles/boxicons.min.css";
import "../app/styles/flaticon.css";
import '@fortawesome/fontawesome-svg-core/styles.css';
import "react-accessible-accordion/dist/fancy-example.css";
import "react-tabs/style/react-tabs.css";
import "swiper/css";
import "swiper/css/bundle";

import type { Metadata } from "next";
import { headers } from "next/headers";

import OrganizationSchema from "../components/Schema/OrganizationSchema";
import WebsiteSchema from "../components/Schema/WebsiteSchema";
import LocalBusinessSchema from "../components/Schema/LocalBusinessSchema";

// Global Styles
import "./globals.css";
import "../app/styles/style.css";


import AosAnimation from "@/components/Layouts/AosAnimation";
import { Nunito } from "next/font/google";
import "../app/styles/responsive.css";
const nunito = Nunito({ subsets: ["latin"] });

export async function generateMetadata(): Promise<Metadata> {
  const headersList = headers();

  const pathname = headersList.get("x-pathname") || "/";

  return {
    metadataBase: new URL("https://www.digihorizon.in"),
    title: "Digi Horizon",
    description: "Digital Marketing, Web Development, SEO and IT Solutions",
    icons: {
      icon: "/img/favicon.png",
    },
    alternates: {
      canonical: pathname,
    },
  };
}


export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <head>
        <link
          rel="preload"
          as="image"
          href="/img/main-banner/banner-two/banner-two-main-img.webp"
          fetchPriority="high"
        />
        <link
          rel="preload"
          href="/fonts/boxicons.woff2"
          as="font"
          type="font/woff2"
          crossOrigin="anonymous"
        />
      </head>
      <body className={nunito.className}>
        <OrganizationSchema />
        <WebsiteSchema />
        <LocalBusinessSchema />
        <Navbar/>
        {/* {children} */}
        <main>
            {children}
        </main>
        
        <BackToTop />
        <AIChatbot />
        <Footer />
        <AosAnimation />
      </body>
    </html>
  );
}
