import { Analytics } from '@vercel/analytics/next'
import { Inter } from 'next/font/google'
import type { Metadata, Viewport } from 'next'
import './globals.css'

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

export const metadata: Metadata = {
  title: {
    default: 'TwoTwentyTwo | Strategic Growth Consulting',
    template: '%s | TwoTwentyTwo',
  },
  description: 'TwoTwentyTwo helps businesses accelerate growth through market expansion strategies, operational optimization, data-driven insights, brand positioning, and client retention consulting.',
  keywords: [
    'strategic consulting',
    'market expansion',
    'business growth',
    'operational efficiency',
    'data-driven insights',
    'brand positioning',
    'client retention',
    'competitive strategy',
    'business strategy',
    'growth consulting',
  ],
  authors: [{ name: 'TwoTwentyTwo' }],
  creator: 'TwoTwentyTwo',
  publisher: 'TwoTwentyTwo',
  metadataBase: new URL('https://twotwentytwo.com'),
  alternates: {
    canonical: '/',
  },
  openGraph: {
    type: 'website',
    locale: 'en_US',
    url: 'https://twotwentytwo.com',
    siteName: 'TwoTwentyTwo',
    title: 'TwoTwentyTwo | Strategic Growth Consulting',
    description: 'Strategic consulting that helps businesses expand markets, optimize operations, and accelerate growth.',
    images: [
      {
        url: '/og-image.png',
        width: 1200,
        height: 630,
        alt: 'TwoTwentyTwo - Technology Consulting',
      },
    ],
  },
  twitter: {
    card: 'summary_large_image',
    title: 'TwoTwentyTwo | Strategic Growth Consulting',
    description: 'Strategic consulting that helps businesses expand markets, optimize operations, and accelerate growth.',
    images: ['/og-image.png'],
  },
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      'max-video-preview': -1,
      'max-image-preview': 'large',
      'max-snippet': -1,
    },
  },
  icons: {
    icon: [
      {
        url: '/icon-light-32x32.png',
        media: '(prefers-color-scheme: light)',
      },
      {
        url: '/icon-dark-32x32.png',
        media: '(prefers-color-scheme: dark)',
      },
      {
        url: '/icon.svg',
        type: 'image/svg+xml',
      },
    ],
    apple: '/apple-icon.png',
  },
}

export const viewport: Viewport = {
  colorScheme: 'light dark',
  themeColor: [
    { media: '(prefers-color-scheme: light)', color: '#ffffff' },
    { media: '(prefers-color-scheme: dark)', color: '#081B33' },
  ],
  width: 'device-width',
  initialScale: 1,
  maximumScale: 5,
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="en" className={`${inter.variable} bg-background`}>
      <head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{
            __html: JSON.stringify({
              '@context': 'https://schema.org',
              '@type': 'Organization',
              name: 'TwoTwentyTwo',
              url: 'https://twotwentytwo.com',
              logo: 'https://twotwentytwo.com/icon.svg',
              description: 'Strategic consulting that helps businesses expand markets, optimize operations, and accelerate growth.',
              sameAs: [
                'https://linkedin.com/company/twotwentytwo',
                'https://twitter.com/twotwentytwo',
              ],
              contactPoint: {
                '@type': 'ContactPoint',
                contactType: 'sales',
                email: 'rsingh@consult222.com',
                telephone: ['+13312121828', '+919041144683'],
              },
            }),
          }}
        />
      </head>
      <body className="antialiased bg-background text-foreground font-[family-name:var(--font-inter)]">
        {children}
        {process.env.NODE_ENV === 'production' && <Analytics />}
      </body>
    </html>
  )
}
