import type { Metadata } from 'next'
import { getLocale, getTranslations } from 'next-intl/server'
import { Inter } from 'next/font/google'
import { Toaster } from 'sonner'

import { LangProvider, ThemeProvider } from '@/providers'

import '@/styles/globals.css'

const inter = Inter({
	subsets: ['latin', 'cyrillic'],
	weight: ['400', '500', '600', '700'],
	display: 'swap',
	variable: '--font-inter-sans'
})

export async function generateMetadata(): Promise<Metadata> {
	const t = await getTranslations('')

	return {
		title: 'BiModal',
		description: t('seo.description')
	}
}

export default async function RootLayout({
	children
}: Readonly<{
	children: React.ReactNode
}>) {
	const locale = await getLocale()

	return (
		<html lang={locale} suppressHydrationWarning>
			<body
				className={`${inter.className} dark:bg-dark-gray-900 bg-white antialiased`}
			>
				<Toaster />
					<LangProvider>
						<ThemeProvider>{children}</ThemeProvider>
					</LangProvider>
			</body>
		</html>
	)
}
