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

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

  return (
    <DocumentRenderer
      key={lang}
      apiEndpoint={`/api/user-agreement?lang=${lang}`}
      title={i18n.language.startsWith('en') ? 'User Agreement' : '用户协议'}
      cacheKey={`user_agreement_${lang}`}
      emptyMessage={i18n.language.startsWith('en') ? 'Failed to load user agreement...' : '加载用户协议内容失败...'}
    />
  );
};

export default UserAgreement;
