import {
	PageContainer,
	WxMaCodeUploadConfig,
	WxMaMessagePushConfig,
	WxMaSubscribeMessageConfig,
} from '@/components';
import { WxMaConfig } from '@/components/Setting';
import { ProCard } from '@ant-design/pro-components';
import { useState } from 'react';

export default function Page() {
	const [activeKey, setActiveKey] = useState<string>('1');

	return (
		<PageContainer
			permission={'MDB_BUSINESS_MINI_PROGRAM_CONFIG'}
			fieldProps={{
				tabActiveKey: activeKey,
				onTabChange: (activeKey) => {
					setActiveKey(activeKey);
				},
				tabList: [
					{
						key: '1',
						tab: '小程序配置',
					},
					{
						key: '2',
						tab: '消息推送设置',
					},
					{
						key: '3',
						tab: '订阅消息配置',
					},
					{
						key: '4',
						tab: '小程序上传',
					},
				],
			}}
		>
			{activeKey === '1' && (
				<ProCard>
					<WxMaConfig />
				</ProCard>
			)}

			{activeKey === '2' && (
				<ProCard>
					<WxMaMessagePushConfig />
				</ProCard>
			)}

			{activeKey === '3' && (
				<ProCard>
					<WxMaSubscribeMessageConfig />
				</ProCard>
			)}

			{activeKey === '4' && (
				<ProCard>
					<WxMaCodeUploadConfig />
				</ProCard>
			)}
		</PageContainer>
	);
}
