import type { Metadata, Viewport } from "next";
import { headers } from "next/headers";
import "./globals.css";
import { JsonLdScript } from "./seo/json-ld";
import { buildPageMetadata } from "./seo/metadata";

export const metadata: Metadata = {
  ...buildPageMetadata(),
  manifest: "/manifest.webmanifest",
  appleWebApp: {
    capable: true,
    title: "Pop Media",
    statusBarStyle: "black-translucent"
  },
  icons: {
    icon: "/favicon.svg",
    apple: "/favicon.svg"
  }
};

export const viewport: Viewport = {
  width: "device-width",
  initialScale: 1,
  themeColor: "#111111"
};

export default async function RootLayout({
  children
}: Readonly<{
  children: React.ReactNode;
}>) {
  const nonce = (await headers()).get("x-nonce") ?? undefined;

  return (
    <html lang="ro">
      <body>
        <JsonLdScript nonce={nonce} />
        {children}
      </body>
    </html>
  );
}
