import type { Metadata } from 'next';
import { Poppins, Oleo_Script_Swash_Caps } from 'next/font/google';
import localFont from 'next/font/local';
import '../css/iconfont.css';
import '../css/iconfont-v2.css';
import './globals.css';
import { Providers } from '@/layout/Providers';
import ProgressBar from '@/layout/Providers/ProgressBar';
import Script from 'next/script';

const poppins = Poppins({
  variable: '--font-poppins',
  weight: ['400', '500', '600', '700'],
  display: 'swap',
  subsets: ['latin'],
});

const oleoScriptSwashCaps = Oleo_Script_Swash_Caps({
  variable: '--font-oleo-script-swash-caps',
  weight: ['400'],
  display: 'swap',
  subsets: ['latin'],
});

const NumDisplay = localFont({
  src: [
    {
      path: './DIN-Alternate-Bold.ttf',
      weight: '700',
      style: 'normal',
    },
  ],
  variable: '--font-display-num',
  display: 'swap',
});

export const metadata: Metadata = {
  metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'),
  title: 'Spicyxx.AI',
  description: 'Spicyxx.AI - Next Generation Social Platform',
};

export default async function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body
        className={`${poppins.variable} ${oleoScriptSwashCaps.variable} ${NumDisplay.variable} antialiased`}
      >
        <Script
          src="//at.alicdn.com/t/c/font_5076160_m6catzpb7dc.js"
          strategy="afterInteractive"
          async
        />
        <Providers>{children}</Providers>
      </body>
    </html>
  );
}
