import React from 'react';
import { useTranslation } from 'react-i18next';
import DocumentRenderer from '../../components/common/DocumentRenderer';

const Terms = () => {
  const { i18n } = useTranslation();
  const lang = i18n.language.startsWith('en') ? 'en' : 'zh';

  return (
    <DocumentRenderer
      key={lang}
      apiEndpoint={`/api/terms?lang=${lang}`}
      title={i18n.language.startsWith('en') ? 'Terms of Service' : '服务条款'}
      cacheKey={`terms_of_service_${lang}`}
      emptyMessage={i18n.language.startsWith('en') ? 'Failed to load terms of service...' : '加载服务条款内容失败...'}
    />
  );
};

export default Terms;
