import { MyPageContainer, useCurrentPermissions } from '@/common';
import type { TabsProps } from 'antd';
import { Tabs } from 'antd';
import MyQuestionCategoriesList from './components/QuestionCategoriesList';
import MyQuestionsList from './components/QuestionsList';
import MySurveyReleasesList from './components/SurveyReleasesList';
import MySurveyResponsesList from './components/SurveyResponsesList';
import MySurveysList from './components/SurveysList';
export default function Index({ title = '问卷调查' }) {
  const getCurrentPermissions = useCurrentPermissions();
  const items: TabsProps['items'] = getCurrentPermissions({
    MySurveyReleasesList: {
      key: 'MySurveyReleasesList',
      label: '问卷发布',
      children: <MySurveyReleasesList />,
    },
    MySurveysList: {
      key: 'MySurveysList',
      label: '问卷设置',
      children: <MySurveysList />,
    },
    MySurveyResponsesList: {
      key: 'MySurveyResponsesList',
      label: '问卷回收',
      children: <MySurveyResponsesList />,
    },
    MyQuestionsList: {
      key: 'MyQuestionsList',
      label: '问卷题库',
      children: <MyQuestionsList />,
    },
    MyQuestionCategoriesList: {
      key: 'MyQuestionCategoriesList',
      label: '题目分类',
      children: <MyQuestionCategoriesList />,
    },
  });
  return (
    <MyPageContainer
      title={title}
      enableTabs={true}
      tabKey="marketing-survey"
      tabLabel={title}
    >
      <Tabs type="card" items={items} />
    </MyPageContainer>
  );
}
