import type { Metadata } from "next";
import { CopilotKit } from "@copilotkit/react-core";
import "./globals.css";

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body>
        <CopilotKit
          publicApiKey={process.env.COPILOT_CLOUD_PUBLIC_API_KEY}
          runtimeUrl={
            process.env.COPILOT_CLOUD_PUBLIC_API_KEY
              ? undefined // Copilot Cloud will provide the runtime URL
              : "/api/copilotkit" // Local runtime
          }
          showDevConsole={false}
        >
          {children}
        </CopilotKit>
      </body>
    </html>
  );
}
