import type { Metadata } from 'next'
import { getLocale } from 'next-intl/server'

const _base = process.env.NEXT_PUBLIC_SITE_URL || 'https://trumpsignal.com'

export const metadata: Metadata = {
  title: 'Terms of Service',
  description: 'Trump Alpha terms of service: non-investment-advice disclaimer, risk disclosure, and permitted use of the platform.',
  alternates: { canonical: `${_base}/en/terms` },
  robots: { index: true, follow: true },
}

export default async function TermsPage() {
  const locale = await getLocale()
  const isZh = false  // i18n shelved — Chinese branches kept as dead code for future revival; see messages/zh.json

  const sections = isZh
    ? [
        {
          title: '1. 接受条款',
          body: '当你连接钱包或使用 Trump Alpha 时，就表示你接受这些服务条款。如果你不同意，请不要继续使用。',
        },
        {
          title: '2. 非投资建议',
          body: 'Trump Alpha 是研究与自动化工具，不是财务顾问。所有信号、AI 分析和自动交易能力都只提供信息与执行工具，不构成投资建议。',
        },
        {
          title: '3. 风险披露',
          body: '加密货币和杠杆交易都伴随显著风险，损失可能超过你的初始投入。开启自动交易前，你需要自行理解并接受这些风险。',
        },
        {
          title: '4. 允许用途',
          body: '你可以将 Trump Alpha 用于个人、非商业目的。未经许可，不得反向工程、批量抓取、转售或重新分发平台上的数据与信号。',
        },
        {
          title: '5. 服务可用性',
          body: '我们会尽量保持高可用，但不保证平台永远不中断。计划维护、基础设施故障或第三方 API 异常都可能影响服务。',
        },
        {
          title: '6. 条款更新',
          body: '我们可能会在未来更新这些条款。更新后继续使用服务，即视为你接受新版本条款。',
        },
        {
          title: '7. 责任限制',
          body: '在法律允许的最大范围内，Trump Alpha 及其运营方不对因使用本服务而产生的间接损失、附带损失或交易损失承担责任。',
        },
      ]
    : [
        {
          title: '1. Acceptance',
          body: 'By connecting a wallet or using Trump Alpha, you accept these Terms of Service. If you do not agree, do not use the product.',
        },
        {
          title: '2. Not Financial Advice',
          body: 'Trump Alpha is a research and automation tool, not a financial advisor. All signals, AI analysis, and auto-trading capabilities are provided as information and execution tooling, not as investment advice.',
        },
        {
          title: '3. Risk Disclosure',
          body: 'Crypto trading and leverage both involve significant risk, including the possibility of losses greater than your initial capital. You are responsible for understanding and accepting those risks before enabling automation.',
        },
        {
          title: '4. Permitted Use',
          body: 'You may use Trump Alpha for personal, non-commercial purposes. You may not reverse-engineer, bulk scrape, resell, or redistribute platform data or signals without permission.',
        },
        {
          title: '5. Service Availability',
          body: 'We aim for high availability, but we do not guarantee uninterrupted service. Maintenance, infrastructure issues, or third-party API outages may affect the platform.',
        },
        {
          title: '6. Modifications',
          body: 'We may update these terms in the future. Continued use of the service after changes means you accept the updated version.',
        },
        {
          title: '7. Limitation of Liability',
          body: 'To the maximum extent permitted by law, Trump Alpha and its operators are not liable for indirect damages, incidental damages, or trading losses arising from use of the service.',
        },
      ]

  return (
    <div className="page" style={{ maxWidth: 720 }}>
      <div className="page-head">
        <div>
          <h1 className="page-title">{isZh ? '服务条款' : 'Terms of Service'}</h1>
          <p className="page-sub">{isZh ? '最后更新：2026 年 4 月' : 'Last updated: April 2026'}</p>
        </div>
      </div>

      <div className="card" style={{ padding: 32, lineHeight: 1.7, fontSize: 14, color: 'var(--ink-2)' }}>
        {sections.map((section, index) => (
          <div key={section.title} style={{ marginBottom: index === sections.length - 1 ? 0 : 20 }}>
            <h2 style={{ fontSize: 16, fontWeight: 600, color: 'var(--ink)', marginBottom: 8 }}>{section.title}</h2>
            <p style={{ marginBottom: 0 }}>
              {section.title.includes('Not Financial Advice') || section.title.includes('非投资建议')
                ? <><strong style={{ color: 'var(--ink)' }}>{section.body}</strong></>
                : section.body}
            </p>
          </div>
        ))}
      </div>
    </div>
  )
}
