import { MyPageContainer, useCurrentPermissions } from '@/common';
import type { TabsProps } from 'antd';
import { Tabs } from 'antd';
import ElectricityFee from './components/ElectricityFee';
import MaintenanceFund from './components/MaintenanceFund';
import PropertyFee from './components/PropertyFee';
import SharedElectricityFee from './components/SharedElectricityFee';
import SharedWaterFee from './components/SharedWaterFee';
import WaterFee from './components/WaterFee';

export default function Index({ title = '收费标准配置' }) {
  const getCurrentPermissions = useCurrentPermissions();

  const items: TabsProps['items'] = getCurrentPermissions({
    PropertyFee: {
      key: 'PropertyFee',
      label: '物业费',
      children: <PropertyFee />,
    },
    WaterFee: {
      key: 'WaterFee',
      label: '水费',
      children: <WaterFee />,
    },
    ElectricityFee: {
      key: 'ElectricityFee',
      label: '电费',
      children: <ElectricityFee />,
    },
    SharedWaterFee: {
      key: 'SharedWaterFee',
      label: '公摊水费',
      children: <SharedWaterFee />,
    },
    SharedElectricityFee: {
      key: 'SharedElectricityFee',
      label: '公摊电费',
      children: <SharedElectricityFee />,
    },
    MaintenanceFund: {
      key: 'MaintenanceFund',
      label: '维修基金',
      children: <MaintenanceFund />,
    },
  });

  return (
    <MyPageContainer
      title={title}
      enableTabs={true}
      tabKey="charge-standard"
      tabLabel={title}
    >
      <Tabs type="card" defaultActiveKey="1" items={items} />
    </MyPageContainer>
  );
}
