import type { Metadata, Viewport } from "next";

import { NuqsAdapter } from "nuqs/adapters/next/app";

import "./globals.css";

import { TailwindIndicator } from "@/components/tailwind-indicator";
import { ThemeProvider } from "@/components/theme-provider";
import { ThemeToggle } from "@/components/theme-toggle";

import { cn, constructMetadata } from "@/lib/utils";

import ReactQueryProvider from "@/providers/react-query-provider";
import { Toaster } from "@/components/ui/sonner";

import MyPrivyProvider from "@/providers/privy-provider";

export const metadata: Metadata = constructMetadata({});

export const viewport: Viewport = {
  colorScheme: "light",
  themeColor: [
    { media: "(prefers-color-scheme: light)", color: "white" },
    { media: "(prefers-color-scheme: dark)", color: "black" },
  ],
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <head>
        <link rel="preconnect" href="https://rsms.me/" />
        <link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
      </head>
      <body
        className={cn(
          "min-h-screen bg-background antialiased w-full mx-auto scroll-smooth"
        )}
      >
        <ReactQueryProvider>
          <MyPrivyProvider>
            <NuqsAdapter>
              <ThemeProvider
                attribute="class"
                defaultTheme="light"
                enableSystem={false}
              >
                {children}
                {/* <ThemeToggle /> */}
                {/* <TailwindIndicator /> */}
                <Toaster richColors />
              </ThemeProvider>
            </NuqsAdapter>
          </MyPrivyProvider>
        </ReactQueryProvider>
      </body>
    </html>
  );
}
