import type { Metadata } from "next";
import { headers } from "next/headers";
import { isLocale } from "@/i18n/routes";
import { site } from "@/content/site";
import { CustomCursor } from "@/components/custom-cursor";
import { ScrollProgress } from "@/components/scroll-progress";
import "./globals.css";

export const metadata: Metadata = {
  metadataBase: new URL(site.url),
  icons: { icon: "/favicon.svg" },
  title: { default: "eldov.win · Self-Hosting, Bots, AI-Fleet", template: "%s · eldov.win" },
  description: "Privates Portfolio von eldov. Hermes, Casino- und Trading-Bots, Self-Hosting, Themes.",
  openGraph: {
    title: "eldov.win",
    description: "Privates Portfolio: Hermes, Bots, Self-Hosting, Hacks.",
    url: site.url,
    siteName: "eldov.win",
    type: "website",
  },
  robots: { index: true, follow: true },
};

export default async function RootLayout({ children }: { children: React.ReactNode }) {
  const h = await headers();
  const lang = isLocale(h.get("x-locale") ?? "") ? (h.get("x-locale") as "de" | "en") : "de";
  return (
    <html lang={lang} className="h-full antialiased">
      <body className="min-h-full">
        <ScrollProgress />
        <CustomCursor />
        {children}
      </body>
    </html>
  );
}
