import "./globals.css";
import type { Metadata } from "next";
import "@/styles/style.css";
import { Arimo, Raleway } from "next/font/google";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import Footer from "@/components/Footer";
import Header from "@/components/Header";
import { cookies } from "next/headers";
import { isAuthenticated } from "@/lib/auth";
import { GTagProvider, PHProvider } from "./providers";
import PrelineScript from "@/components/Utilities/PrelineScript";

const raleway = Raleway({
  variable: "--display-font",
  subsets: ["latin"],
});

const arimo = Arimo({
  variable: "--body-font",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "Sign365",
  description:
    "Sign365 is your window into freedom from paper work. Get the paper work to do itself",
};

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const isUserLoggedIn = await isAuthenticated(cookies());
  return (
    <html lang="en" className="h-full">
      <PHProvider>
        <GTagProvider />
        <body className={`${arimo.className} bg-black flex`}>
          <Header isUserLoggedIn={isUserLoggedIn} />
          {children}
          <ToastContainer
            position="bottom-left"
            autoClose={5000}
            hideProgressBar={false}
            newestOnTop={false}
            closeOnClick
            rtl={false}
            pauseOnFocusLoss
            draggable
            pauseOnHover
            theme="colored"
          />
        </body>
        <PrelineScript />
      </PHProvider>
    </html>
  );
}
