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

// 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 contact page
export async function generateMetadata({
    params: { locale },
}: {
    params: { locale: string };
}): Promise<Metadata> {
    const language = locale === 'zh' ? 'zh-CN' : locale === 'zh-CN' ? 'zh-CN' : locale === 'zh-TW' ? 'zh-TW' : 'en';
    const seo = getSEOConfig('contact', language);

    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 === 'zh' ? '/contact' : `/${locale}/contact`,
            languages: {
                'zh-CN': '/contact',
                'zh-TW': '/zh-TW/contact',
                en: '/en/contact',
            },
        },
    };
}

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