
import localFont from "next/font/local";
import { Toaster } from "sonner";
import "./globals.css";
import { ThemeProvider } from "@/components/theme-provider";
import { getSiteContents } from "@/lib/data";

const inter = localFont({
  src: [
    { path: "../public/fonts/Inter-Thin.ttf", weight: "100", style: "normal" },
    { path: "../public/fonts/Inter-ExtraLight.ttf", weight: "200", style: "normal" },
    { path: "../public/fonts/Inter-Light.ttf", weight: "300", style: "normal" },
    { path: "../public/fonts/Inter-Regular.ttf", weight: "400", style: "normal" },
    { path: "../public/fonts/Inter-Medium.ttf", weight: "500", style: "normal" },
    { path: "../public/fonts/Inter-SemiBold.ttf", weight: "600", style: "normal" },
    { path: "../public/fonts/Inter-Bold.ttf", weight: "700", style: "normal" },
    { path: "../public/fonts/Inter-ExtraBold.ttf", weight: "800", style: "normal" },
    { path: "../public/fonts/Inter-Black.ttf", weight: "900", style: "normal" },
  ],
  variable: "--font-inter",
});

const outfit = localFont({
  src: [
    { path: "../public/fonts/Outfit-Thin.ttf", weight: "100", style: "normal" },
    { path: "../public/fonts/Outfit-ExtraLight.ttf", weight: "200", style: "normal" },
    { path: "../public/fonts/Outfit-Light.ttf", weight: "300", style: "normal" },
    { path: "../public/fonts/Outfit-Regular.ttf", weight: "400", style: "normal" },
    { path: "../public/fonts/Outfit-Medium.ttf", weight: "500", style: "normal" },
    { path: "../public/fonts/Outfit-SemiBold.ttf", weight: "600", style: "normal" },
    { path: "../public/fonts/Outfit-Bold.ttf", weight: "700", style: "normal" },
    { path: "../public/fonts/Outfit-ExtraBold.ttf", weight: "800", style: "normal" },
    { path: "../public/fonts/Outfit-Black.ttf", weight: "900", style: "normal" },
  ],
  variable: "--font-outfit",
});


export async function generateMetadata() {
  const settings = await getSiteContents();

  return {
    title: settings.site_title || "ParaKasa - Premium Çelik Kasalar",
    description: settings.site_description || "Eviniz ve iş yeriniz için en yüksek güvenlikli çelik kasa ve para sayma çözümleri.",
  };
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="tr" suppressHydrationWarning>
      <body
        className={`${inter.className} ${outfit.variable} antialiased min-h-screen flex flex-col`}
      >
        <ThemeProvider
          attribute="class"
          defaultTheme="system"
          enableSystem
          disableTransitionOnChange
        >
          {children}
          <Toaster />
        </ThemeProvider>
      </body>
    </html>
  );
}
