import './globals.css';
import './styles.css';
import 'swiper/css';
import 'swiper/css/autoplay';
import 'simplebar-react/dist/simplebar.min.css';
import 'aos/dist/aos.css';

// import type { Metadata } from 'next';
import { MainProvider } from '@/providers';

// export const metadata: Metadata = {
//     title: 'CPost-Express',
//     description: 'CPost-Express',
// };

export default function RootLayout({ children, params: { locale } }: { children?: React.ReactNode; params: { locale: string } }) {
    const siteLanguage = locale || 'ru';

    const seoRu = {
        title: 'Cpost express: Авиапочта из Китая в Узбекистан',
        desc: 'Cpost express ✈️Авиапочта из Китая в Узбекистан, ⏳Срок доставки 5-14 дней, 📦Минимальный заказ 0 кг, 📷Фото отчёт, 🛃Гарантия сохранности посылок, ☎️ +998 90-113-44-77 админ',
        keywords:
            'Cpost express, Авиапочта, Китай, Узбекистан, доставка, срок доставки, минимальный заказ, фото отчёт, гарантия сохранности, посылки, контакты, админ',
        img: 'https://cpost-express.uz/logo.jpeg',
    };
    const seoUz = {
        title: "Cpost express: Xitoydan O'zbekistonga aviapochta",
        desc: "Cpost express ✈️Xitoydan O'zbekistonga aviapoçta, ⏳Yetkazib berish muddati 5-14 kun, 📦Minimal buyurtma 0 kg, 📷Surat maqola, 🛃Poçta xavfsizligi kafolati, ☎️ +998 90-113-44-77 admin",
        keywords:
            "Cpost express, Aviapoçta, Xitoy, O'zbekiston, yetkazib berish, yetkazib berish muddati, minimal buyurtma, surat maqola, poçta xavfsizligi kafolati, aloqa ma'lumotlari, admin",
        img: 'https://cpost-express.uz/logo.jpeg',
    };
    const seoEn = {
        title: 'Cpost express: Air Mail from China to Uzbekistan',
        desc: 'Cpost express ✈️Air Mail from China to Uzbekistan, ⏳Delivery time 5-14 days, 📦Minimum order 0 kg, 📷Photo report, 🛃Guarantee of parcel safety, ☎️ +998 90-113-44-77 admin',
        keywords:
            'Cpost express, Air mail, China, Uzbekistan, delivery, delivery time, minimum order, photo report, guarantee of parcel safety, contacts, admin',
        img: 'https://cpost-express.uz/logo.jpeg',
    };

    let seo = seoRu;
    switch (siteLanguage) {
        case 'ru': {
            seo = seoRu;
            break;
        }
        case 'uz': {
            seo = seoUz;
            break;
        }
        case 'en': {
            seo = seoEn;
            break;
        }
        default: {
            seo = seoRu;
        }
    }

    const alternates = [
        {
            link: `https://cpost-express.uz/ru`,
            hreflang: 'ru',
        },
        {
            link: `https://cpost-express.uz/en`,
            hreflang: 'en',
        },
        {
            link: `https://cpost-express.uz/uz`,
            hreflang: 'uz',
        },
    ];

    return (
        <html lang={siteLanguage}>
            <head>
                <title>{seo.title}</title>
                <meta name='description' content={seo.desc} />
                <meta name='keywords' content={seo.keywords} />

                <meta property='og:type' content='website' />
                <meta property='og:title' content={seo.title} />
                <meta property='og:description' content={seo.desc} />
                <meta property='og:url' content={seo.img} />

                {alternates
                    .filter((i, index) => {
                        if (siteLanguage === 'ru') {
                            return index !== 0;
                        }
                        if (siteLanguage === 'en') {
                            return index !== 1;
                        }
                        if (siteLanguage === 'uz') {
                            return index !== 2;
                        }
                    })
                    .map(({ link, hreflang }) => {
                        return <link rel='alternate' href={link} hrefLang={hreflang} key={hreflang} />;
                    })}

                <link rel='preconnect' href='https://fonts.googleapis.com' />
                <link rel='preconnect' href='https://fonts.gstatic.com' crossOrigin='' />
                <link href='https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap' rel='stylesheet' />
                <link href='https://fonts.cdnfonts.com/css/sf-pro-display' rel='stylesheet' />

                <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1' />
                <link rel='apple-touch-icon' sizes='180x180' href='/apple-touch-icon.png' />
                <link rel='icon' type='image/png' sizes='32x32' href='/favicon-32x32.png' />
                <link rel='icon' type='image/png' sizes='16x16' href='/favicon-16x16.png' />
                <link rel='manifest' href='/site.webmanifest' />
            </head>
            <body>
                <MainProvider>{children}</MainProvider>
            </body>
        </html>
    );
}

// export async function generateStaticParams() {
//     return [
//         {
//             locale: 'uz',
//         },
//         {
//             locale: 'ru',
//         },
//         {
//             locale: 'en',
//         },
//     ];
// }
