import React from 'react';
import localFont from 'next/font/local'
import type { Metadata } from 'next';

import { Locale, i18n } from '@/i18n.config';

import './globals.css';

export async function generateStaticParams() {
  return i18n.locales.map(locale => ({ lang: locale }))
};

export const metadata: Metadata = {
  title: 'Museu do Jardim Botânico',
  description: 'Aplicativo do Museu do Jardim Botânico do Rio de Janeiro',
};

const factorA = localFont({
  src: [
    {
      path: '../../static-fonts/FactorA-Regular.ttf',
      style: 'normal',
      weight: 'normal',
    }, {
      path: '../../static-fonts/FactorA-Italic.ttf',
      style: 'italic',
      weight: 'normal',
    }, {
      path: '../../static-fonts/FactorA-Medium.ttf',
      style: 'normal',
      weight: '500',
    }, {
      path: '../../static-fonts/FactorA-MediumItalic.ttf',
      style: 'italic',
      weight: '500',
    }, {
      path: '../../static-fonts/FactorA-Bold.ttf',
      style: 'normal',
      weight: 'bold',
    }, {
      path: '../../static-fonts/FactorA-BoldItalic.ttf',
      style: 'italic',
      weight: 'bold',
    }, {
      path: '../../static-fonts/FactorA-Black.ttf',
      style: 'normal',
      weight: '900',
    }, {
      path: '../../static-fonts/FactorA-BlackItalic.ttf',
      style: 'italic',
      weight: '900',
    },
  ],
  variable: '--font-factor-a',
});

export default function RootLayout({
  children, params,
}: {
  children: React.ReactNode; params: { lang: Locale };
}) {
  return (
    <html lang={['pt-au', 'libras'].includes(params?.lang) ? 'pt' : params?.lang}>
      <body className={factorA.className}>{children}</body>
    </html>
  );
};
