import React from 'react';
import { getMessages } from 'next-intl/server';
import Providers from '@/components/Providers';
import '@/css/tailwind.css';
import { headers } from 'next/headers';

export const metadata = {
  title: 'N3WT-SCHOOL',
  description: "Gestion de l'école",
  icons: {
    icon: [
      {
        url: '/favicon.svg',
        type: 'image/svg+xml',
      },
      {
        url: '/favicon.ico', // Fallback pour les anciens navigateurs
        sizes: 'any',
      },
    ],
  },
};

export default async function RootLayout({ children, params }) {
  const headersList = headers();
  const locale = headersList.get('x-locale') || 'fr';
  const messages = await getMessages(locale);

  return (
    <html lang={locale}>
      <body>
        <Providers messages={messages} locale={locale} session={params.session}>
          {children}
        </Providers>
      </body>
    </html>
  );
}
