import type { Metadata, Viewport } from "next";
// import { detectLanguage } from "@/i18n";
// import ThemeRegistry from "@/theme/ThemeRegistry";
import { detectLanguage } from "../i18n";
import ThemeRegistry from "../theme/ThemeRegistry";

export const metadata: Metadata = {
  title: "FPSMS",
  description: "FPSMS - xxxx Management System",
};

/** Tablet/mobile: virtual keyboard overlays content instead of resizing viewport (avoids "half screen gone"). */
export const viewport: Viewport = {
  width: "device-width",
  initialScale: 1,
  viewportFit: "cover",
  interactiveWidget: "overlays-content",
};

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const lang = await detectLanguage();

  return (
    <html lang={lang}>
      <body>
        <ThemeRegistry lang={lang}>{children}</ThemeRegistry>
      </body>
    </html>
  );
}
