import { Footer } from '@/components/footer'
import { Header } from '@/components/header'
import { ThemeProvider } from '@/components/providers/theme-provider'
import '@/styles/globals.css'
import { StyledEngineProvider } from '@mui/material'
import type { Metadata } from 'next'
import { Poppins } from 'next/font/google'
import { Toaster } from 'sonner'

import { AuthProvider } from '@/contexts/auth-context'
import ReactQueryProvider from '@/providers/react-query'

const poppins = Poppins({ subsets: ['latin'], weight: ['300', '400', '800'] })

export const metadata: Metadata = {
  title: 'Seven Pro',
  description: 'Transforme sua vida através do conhecimento',
}

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode
}>) {
  return (
    <html lang="pt-BR">
      <body className={`antialiased ${poppins.className}`}>
        <AuthProvider>
          <ThemeProvider
            attribute="class"
            defaultTheme="dark"
            enableSystem
            disableTransitionOnChange
          >
            <StyledEngineProvider injectFirst>
              <ReactQueryProvider>
                <Toaster richColors />
                <Header />
                {children}
                <Footer />
              </ReactQueryProvider>
            </StyledEngineProvider>
          </ThemeProvider>
        </AuthProvider>
      </body>
    </html>
  )
}
