import "./globals.css";
import Header from "@/app/components/common/header";
import Footer from "@/app/components/common/footer";
import NavigationEventsProvider from "./providers/NavigationEventsProvider";
import { ReduxProvider } from "./providers/ReduxProvider";
import ToastProvider from "./components/toastProvider";
import ScrollRestoration from "./components/ScrollRestoration";
import { NextAuthProvider } from "./providers/NextAuthProvider";
import GoogleAnalytics from "./components/GoogleAnalytics";
import { Metadata } from "next";
import CookieConsent from "./components/CookieConsent";

import { DM_Mono } from "next/font/google";

const dmMono = DM_Mono({
  subsets: ["latin"],
  weight: ["300", "400", "500"],
  display: "swap",
  variable: "--font-sans",
});
const SITE_URL = "https://mymorni.com";
const SEO = {
  title: "Morni | Be Your Own Brand | Custom Clothing, Made in India",
  description:
    "Morni lets you design and create your own clothing, made with natural fabrics and traditional Indian craftsmanship. Be your own brand. No Minimums. No Middlemen.",
  image: `${SITE_URL}/images/morni-og-banner.jpg`,
  logo: `${SITE_URL}/images/morni-og-logo.jpg`,
};

export const metadata: Metadata = {
  title: SEO.title,
  description: SEO.description,
  applicationName: "Morni",
  metadataBase: new URL("https://mymorni.com"),
  keywords: [
    "custom clothing",
    "made in india",
    "private label clothing",
    "custom fashion",
    "fashion manufacturing",
    "sustainable clothing",
    "natural fabrics",
    "clothing brand startup",
    "custom apparel",
    "indian craftsmanship",
  ],

  authors: [
    {
      name: "Morni",
      url: SITE_URL,
    },
  ],
  creator: "Morni",
  publisher: "Morni",

  alternates: {
    canonical: "/",
  },
  robots: {
    index: true,
    follow: true,

    googleBot: {
      index: true,
      follow: true,
      "max-image-preview": "large",
      "max-video-preview": -1,
      "max-snippet": -1,
    },
  },
  openGraph: {
    type: "website",
    locale: "en_IN",
    url: SITE_URL,
    siteName: "Morni",
    title: SEO.title,
    description: SEO.description,

    images: [
      {
        url: SEO.image,
        width: 1200,
        height: 630,
        alt: "Morni Custom Clothing Made in India",
      },
    ],
  },
  twitter: {
    card: "summary_large_image",
    title: SEO.title,
    description: SEO.description,
    images: [SEO.image],
    creator: "@my.morni",
  },
  icons: {
    icon: [
      {
        url: "/favicon.ico",
      },
    ],
    apple: [
      {
        url: SEO.logo,
      },
    ],
  },
  appleWebApp: {
    capable: true,
    statusBarStyle: "default",
    title: "Morni",
  },
  category: "fashion",
};

export default function MainLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  const organizationSchema = {
    "@context": "https://schema.org",
    "@type": "Organization",
    name: "Morni",
    url: SITE_URL,
    logo: SEO.logo,
    description: SEO.description,
    email: "studio@mymorni.com",
    sameAs: ["https://www.instagram.com/my.morni"],
  };

  const websiteSchema = {
    "@context": "https://schema.org",
    "@type": "WebSite",
    name: "Morni",
    url: SITE_URL,
    potentialAction: {
      "@type": "SearchAction",
      target: `${SITE_URL}/search?q={search_term_string}`,
      "query-input": "required name=search_term_string",
    },
  };
  return (
    <html lang="en" data-scroll-behavior="smooth" className={dmMono.className}>
      <body className="scroll-smooth bg-gray-100">
        <GoogleAnalytics />
        <ScrollRestoration />
        <ToastProvider />
        <NextAuthProvider>
          <ReduxProvider>
            <Header />
            <NavigationEventsProvider>{children}</NavigationEventsProvider>
            <CookieConsent />
            <Footer />
          </ReduxProvider>
        </NextAuthProvider>
      </body>
    </html>
  );
}
