import type { Metadata } from 'next';
import { getSEOConfig } from '../../lib/seo-config';
import HomePageClient from '@/app/components/home';

// Generate static params for supported locales
export async function generateStaticParams() {
    return [
        { locale: 'zh' },
        { locale: 'zh-CN' },
        { locale: 'zh-TW' },
        { locale: 'en' },
    ];
}

// Generate metadata for the home page
export async function generateMetadata({
    params: { locale },
}: {
    params: { locale: string };
}): Promise<Metadata> {
    const seo = getSEOConfig('home', locale);

    return {
        title: seo.title,
        description: seo.description,
        keywords: seo.keywords,
        openGraph: {
            title: seo.openGraph?.title,
            description: seo.openGraph?.description,
            type: seo.openGraph?.type as any,
            images: seo.openGraph?.images,
        },
        twitter: {
            card: seo.twitter?.card as any,
            title: seo.twitter?.title,
            description: seo.twitter?.description,
            images: seo.twitter?.images,
        },
        alternates: {
            canonical: `/${locale}`,
            languages: {
                'zh-CN': '/zh-CN',
                'zh-TW': '/zh-TW',
                en: '/en',
            },
        },
    };
}

export default function Page({ params: { locale } }: { params: { locale: string } }) {
    return <HomePageClient locale={locale} />;
}
