import { type ModuleConfig } from '/@/cool';
import { router } from '/@/cool';
import './service';

export default (): ModuleConfig => {
	return {
		order: 10,
		views: [
			{
				path: '/aiconfig/model',
				meta: {
					label: 'AI模型配置'
				},
				component: () => import('./views/model.vue')
			},
			{
				path: '/aiconfig/api-config',
				meta: {
					label: 'AI接口配置'
				},
				component: () => import('./views/api-config.vue')
			},
			{
				path: '/aiconfig/template',
				meta: {
					label: 'AI模板配置'
				},
				component: () => import('./views/template.vue')
			}
		],
		onLoad() {
			// 确保路由被正确添加到 router 中
			const moduleRoutes = [
				{
					path: '/aiconfig/model',
					meta: {
						label: 'AI模型配置'
					},
					component: () => import('./views/model.vue')
				},
				{
					path: '/aiconfig/api-config',
					meta: {
						label: 'AI接口配置'
					},
					component: () => import('./views/api-config.vue')
				},
				{
					path: '/aiconfig/template',
					meta: {
						label: 'AI模板配置'
					},
					component: () => import('./views/template.vue')
				}
			];
			
			// 将路由添加到 router 中
			router.append(moduleRoutes);
		}
	};
};