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

export function NaiveConfiguration({ parseType = ParseType.BuildIn }: { parseType?: ParseType }) {
  const { formState: { errors } } = useFormContext();
  const { t } = useTranslation();

  return (
    <ConfigurationFormContainer>
      <MainContainer>
        {/* 第一部分：basicConfig 基础配置 */}
        {parseType === ParseType.BuildIn && (
          <Accordion defaultExpanded>
            <AccordionSummary expandIcon={<ExpandMoreIcon />}>
              <Typography variant="h6">{t('knowledge.config.basicConfig')}</Typography>
            </AccordionSummary>
            <AccordionDetails>
              <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
                <BasicConfigItems />
              </Box>
            </AccordionDetails>
          </Accordion>
        )}

        {/* 第二部分：RAPTOR策略 */}
        <Accordion>
          <AccordionSummary expandIcon={<ExpandMoreIcon />}>
            <Typography variant="h6">{t('knowledge.config.raptorStrategy')}</Typography>
          </AccordionSummary>
          <AccordionDetails>
            <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
              {/* 最大聚类数 */}
              <RaptorConfigItems />
            </Box>
          </AccordionDetails>
        </Accordion>

        {/* 第三部分：Knowledge Graph 知识图谱 */}
        <Accordion>
          <AccordionSummary expandIcon={<ExpandMoreIcon />}>
            <Typography variant="h6">{t('knowledge.config.knowledgeGraph')}</Typography>
          </AccordionSummary>
          <AccordionDetails>
            <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
              <KnowledgeGraphConfigItems />
            </Box>
          </AccordionDetails>
        </Accordion>
      </MainContainer>
    </ConfigurationFormContainer>
  );
}