import type { Metadata } from 'next';
import SecurityPageClient from './SecurityPageClient';
import { getTranslations, type Language } from '@/lib/languages';

export async function generateMetadata({
    params,
}: {
    params: { lang: string };
}): Promise<Metadata> {
    const lang = params.lang as Language;
    const t = getTranslations(lang);
    const seoData = t.seo.security;

    const baseUrl = 'https://cybercloud.com';
    const currentUrl = `${baseUrl}/${lang}/security`;

    return {
        title: seoData.title,
        description: seoData.description,
        keywords: seoData.keywords,
        openGraph: {
            type: 'website',
            locale: lang === 'zh' ? 'zh_CN' : lang === 'tw' ? 'zh_TW' : 'en_US',
            url: currentUrl,
            siteName: 'CyberCloud',
            title: seoData.title,
            description: seoData.description,
        },
        alternates: {
            canonical: currentUrl,
            languages: {
                zh: `${baseUrl}/zh/security`,
                'zh-CN': `${baseUrl}/zh/security`,
                'zh-TW': `${baseUrl}/tw/security`,
                'zh-HK': `${baseUrl}/tw/security`,
                en: `${baseUrl}/en/security`,
            },
        },
    };
}

export default function SecurityPage({ params }: { params: { lang: string } }) {
    return <SecurityPageClient params={params} />;
}
