import { GeistSans } from "geist/font/sans";
import { GeistMono } from "geist/font/mono";
import './globals.css';
import { Metadata } from 'next';

import { SidebarProvider } from '@/context/SidebarContext';
import { ThemeProvider } from '@/context/ThemeContext';
import { ToastProvider } from '@/context/ToastContext';
import { ToastContainer } from '@/components/ui/toast/Toast';
import { I18nProvider } from '@/components/providers/I18nProvider';


export const metadata: Metadata = {
  metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL || 'https://trustlab.dyzulk.com'),
  applicationName: 'TrustLab',
  alternates: {
    canonical: '/',
  },
  title: {
    template: '%s | TrustLab - SSL & Certificate Management',
    default: 'TrustLab | SSL & Certificate Management',
  },
  description: 'Manage SSL/TLS certificates and private certificate authorities for internal infrastructure.',
  keywords: ['SSL', 'TLS', 'Certificate Management', 'Private CA', 'TrustLab'],
  authors: [{ name: 'TrustLab Team' }],
  creator: 'TrustLab',
  publisher: 'TrustLab',
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      'max-video-preview': -1,
      'max-image-preview': 'large',
      'max-snippet': -1,
    },
  },
  openGraph: {
    type: 'website',
    locale: 'en_US',
    url: 'https://trustlab.dyzulk.com',
    siteName: 'TrustLab',
    title: 'TrustLab | SSL & Certificate Management',
    description: 'Manage SSL/TLS certificates and private certificate authorities.',
    images: [
      {
        url: '/banner.png',
        width: 1200,
        height: 630,
        alt: 'TrustLab Platform',
      },
    ],
  },
  twitter: {
    card: 'summary_large_image',
    title: 'TrustLab | SSL & Certificate Management',
    description: 'Securely manage SSL/TLS certificates and internal CAs with TrustLab.',
    images: ['/banner.png'],
    creator: '@dyzulk',
  },
  icons: {
    icon: '/favicon.ico',
    shortcut: '/favicon.ico',
  },
  verification: {
    google: 'C7cNjxkyxXcQHExRsdhIGjZ658BcK9ftuIpJK8NYRGc',
  },
  category: 'security',
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body className={`${GeistSans.variable} ${GeistMono.variable} antialiased dark:bg-gray-900`} suppressHydrationWarning>
        <ThemeProvider>
          <I18nProvider>
            <ToastProvider>
              <SidebarProvider>{children}</SidebarProvider>
              <ToastContainer />
            </ToastProvider>
          </I18nProvider>
        </ThemeProvider>
      </body>
    </html>
  );
}
