import type { Metadata } from "next";
import { Suspense } from "react";
import { Bricolage_Grotesque, Outfit, Geist_Mono } from "next/font/google";
import { ThemeProvider } from "@/lib/themes/theme-provider";
import { QueryProvider } from "@/lib/query/query-provider";
import { PostHogProvider } from "@/lib/analytics/posthog-provider";
import { Toaster } from "@/components/ui/sonner";
import "./globals.css";

const bricolage = Bricolage_Grotesque({
  variable: "--font-bricolage",
  subsets: ["latin"],
  display: "swap",
});

const outfit = Outfit({
  variable: "--font-outfit",
  subsets: ["latin"],
  display: "swap",
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: {
    default: "honeyDue — Home Maintenance Made Simple",
    template: "%s | honeyDue",
  },
  description:
    "Track tasks, organize contractors, store documents. Manage your home maintenance in one place.",
  openGraph: {
    title: "honeyDue — Home Maintenance Made Simple",
    description:
      "Track tasks, organize contractors, store documents. Manage your home maintenance in one place.",
    type: "website",
    siteName: "honeyDue",
  },
  twitter: {
    card: "summary_large_image",
    title: "honeyDue — Home Maintenance Made Simple",
    description: "Home Maintenance Made Simple",
  },
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body
        className={`${bricolage.variable} ${outfit.variable} ${geistMono.variable} antialiased`}
      >
        <Suspense fallback={null}>
          <PostHogProvider>
            <QueryProvider>
              <ThemeProvider>
                {children}
                <Toaster richColors closeButton />
              </ThemeProvider>
            </QueryProvider>
          </PostHogProvider>
        </Suspense>
      </body>
    </html>
  );
}
