import React from 'react';
import { Box, Typography, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
import { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';
import { useTranslation } from 'react-i18next';
import { ConfigurationFormContainer } from './configuration-form-container';
import { 
  RaptorConfigItems,
  KnowledgeGraphConfigItems
} from './common-items';
import { ParseType } from '@/constants/knowledge';

export function QAConfiguration({ parseType = ParseType.BuildIn }: { parseType?: ParseType }) {
  const { t } = useTranslation();

  return (
    <ConfigurationFormContainer>
      <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
        {/* 基础配置：已在 ChunkMethodForm 中处理，且仅在 buildIn 时显示 */}

        {/* 第二部分：RAPTOR策略 */}
        <Accordion>
          <AccordionSummary expandIcon={<ExpandMoreIcon />}>
            <Typography variant="h6">{t('knowledge.config.raptorStrategy')}</Typography>
          </AccordionSummary>
          <AccordionDetails>
            <RaptorConfigItems />
          </AccordionDetails>
        </Accordion>

        {/* 第三部分：Knowledge Graph 知识图谱 */}
        <Accordion>
          <AccordionSummary expandIcon={<ExpandMoreIcon />}>
            <Typography variant="h6">{t('knowledge.config.knowledgeGraph')}</Typography>
          </AccordionSummary>
          <AccordionDetails>
            <KnowledgeGraphConfigItems />
          </AccordionDetails>
        </Accordion>
      </Box>
    </ConfigurationFormContainer>
  );
}