import type { Metadata } from "next";
import { getNonce } from "@repo/core-shared/security/next";
import { Providers } from "./providers";

export const metadata: Metadata = {
  title: "Template — Next.js",
  description: "Clean Architecture Monorepo Template",
};

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

  return (
    <html lang="en">
      <head>
        {/* nonce exposed to client so instrumentation-client.ts can read it */}
        <meta name="csp-nonce" content={nonce} />
      </head>
      <body>
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}
