import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import { Inter } from 'next/font/google';
import './globals.css';
import './styles/registration-theme.css';
import { AuthProvider } from '@/components/AuthProvider';
import { GoogleAnalytics } from '@/components/analytics/GoogleAnalytics';
import { getSiteUrl } from '@/lib/site-url';

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

const siteUrl = getSiteUrl();

export const metadata: Metadata = {
  title: 'AMSOIL Dealer Lead Pages',
  description: 'Dealer lead page management dashboard with Google and Apple authentication.',
  metadataBase: siteUrl,
  icons: {
    icon: [
      { url: '/favicon.ico', type: 'image/x-icon' },
      { url: '/favicon-16x16.png', type: 'image/png', sizes: '16x16' },
      { url: '/favicon-32x32.png', type: 'image/png', sizes: '32x32' },
      { url: '/favicon-48x48.png', type: 'image/png', sizes: '48x48' },
      { url: '/favicon-64x64.png', type: 'image/png', sizes: '64x64' },
      { url: '/favicon-96x96.png', type: 'image/png', sizes: '96x96' },
      { url: '/favicon-128x128.png', type: 'image/png', sizes: '128x128' },
      { url: '/favicon-196x196.png', type: 'image/png', sizes: '196x196' },
    ],
    shortcut: '/favicon.ico',
  },
  alternates: {
    canonical: '/',
    languages: {
      'en-US': '/',
      en: '/',
    },
  },
  openGraph: {
    url: siteUrl.toString(),
    title: 'AMSOIL Dealer Lead Pages',
    description: 'Dealer lead page management dashboard with Google and Apple authentication.',
  },
  twitter: {
    card: 'summary_large_image',
    title: 'AMSOIL Dealer Lead Pages',
    description: 'Dealer lead page management dashboard with Google and Apple authentication.',
  },
};

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="en" className={inter.variable}>
      <body className={inter.className}>
        <GoogleAnalytics />
        <AuthProvider>{children}</AuthProvider>
      </body>
    </html>
  );
}
