import type { Metadata } from 'next'
import { Inter, Source_Serif_4 } from 'next/font/google'
import './globals.css'

const inter = Inter({
  subsets: ['latin'],
  display: 'swap',
  variable: '--font-inter',
})

const sourceSerif = Source_Serif_4({
  subsets: ['latin'],
  display: 'swap',
  variable: '--font-source-serif',
  style: ['normal', 'italic'],
  axes: ['opsz'],
})

export const metadata: Metadata = {
  metadataBase: new URL('https://greywall.io'),
  title: 'Greywall: Sandbox for AI Agents',
  description:
    'Frictionless sandboxing with real-time observability for AI agents on Linux and macOS. One command, nothing to configure. Open source.',
  icons: {
    icon: [
      { url: '/icon.svg', type: 'image/svg+xml' },
      { url: '/icon-dark-32x32.png', sizes: '32x32', type: 'image/png', media: '(prefers-color-scheme: dark)' },
      { url: '/icon-light-32x32.png', sizes: '32x32', type: 'image/png', media: '(prefers-color-scheme: light)' },
    ],
    apple: '/apple-icon.png',
  },
  openGraph: {
    title: 'Greywall: Sandbox for AI Agents',
    description: 'Frictionless sandboxing with real-time observability for AI agents. One command, nothing to configure.',
    url: 'https://greywall.io',
    siteName: 'Greywall',
    type: 'website',
    images: [{ url: '/og-image.png', width: 1200, height: 630 }],
  },
  twitter: {
    card: 'summary_large_image',
    title: 'Greywall: Sandbox for AI Agents',
    description: 'Frictionless sandboxing with real-time observability for AI agents. One command, nothing to configure.',
    images: ['/og-image.png'],
  },
  alternates: {
    canonical: 'https://greywall.io',
  },
}

const jsonLd = {
  '@context': 'https://schema.org',
  '@graph': [
    {
      '@type': 'Organization',
      '@id': 'https://greyhaven.co/#organization',
      name: 'Greyhaven',
      url: 'https://greyhaven.co',
      logo: { '@type': 'ImageObject', url: 'https://greywall.io/icon.svg' },
      sameAs: ['https://github.com/GreyhavenHQ'],
    },
    {
      '@type': 'WebSite',
      '@id': 'https://greywall.io/#website',
      name: 'Greywall',
      url: 'https://greywall.io',
      publisher: { '@id': 'https://greyhaven.co/#organization' },
    },
    {
      '@type': 'SoftwareApplication',
      '@id': 'https://greywall.io/#software',
      name: 'Greywall',
      description:
        'Frictionless sandboxing with real-time observability and dynamic controls for AI agents on Linux and macOS.',
      applicationCategory: 'SecurityApplication',
      operatingSystem: 'Linux, macOS',
      url: 'https://greywall.io',
      downloadUrl: 'https://github.com/GreyhavenHQ/greywall',
      license: 'https://opensource.org/licenses/Apache-2.0',
      offers: { '@type': 'Offer', price: '0', priceCurrency: 'USD' },
      author: { '@id': 'https://greyhaven.co/#organization' },
      featureList: [
        'Filesystem isolation',
        'Network isolation',
        'Command blocking',
        'Real-time violation monitoring',
        'Learning mode',
        'Syscall filtering',
        'Dynamic allow/deny controls',
      ],
      isAccessibleForFree: true,
    },
    {
      '@type': 'SoftwareSourceCode',
      name: 'Greywall',
      codeRepository: 'https://github.com/GreyhavenHQ/greywall',
      programmingLanguage: 'Go',
      license: 'https://opensource.org/licenses/Apache-2.0',
      targetProduct: { '@id': 'https://greywall.io/#software' },
    },
  ],
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="en" className={`dark ${inter.variable} ${sourceSerif.variable}`}>
      <head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
        />
      </head>
      <body className="font-sans antialiased bg-background text-foreground">
        {children}
      </body>
    </html>
  )
}
