﻿import { lazy } from 'react'
import type { AdminRole } from '@/types/admin'

const Dashboard = lazy(() => import('@/pages/Dashboard'))
const TaskAssistant = lazy(() => import('@/pages/TaskAssistant'))
const UserManagement = lazy(() => import('@/pages/UserManagement'))

export interface RouteConfig {
  path: string
  title: string
  element: React.LazyExoticComponent<React.ComponentType<any>>
  requiredRole?: AdminRole
}

export const routeConfig: RouteConfig[] = [
  { path: '/', title: '总览', element: Dashboard },
  { path: '/assistant', title: '任务助理', element: TaskAssistant },
  { path: '/users', title: '用户管理', element: UserManagement, requiredRole: 'ADMIN' },
  { path: '/users/admins', title: '管理员', element: UserManagement, requiredRole: 'SUPER_ADMIN' },
  { path: '/users/members', title: '普通用户', element: UserManagement },
  { path: '/membership', title: '会员与额度', element: UserManagement, requiredRole: 'ADMIN' },
  { path: '/knowledge/bases', title: '知识库列表', element: UserManagement },
  { path: '/knowledge/sources', title: '知识源列表', element: UserManagement },
  { path: '/imports', title: '文档导入', element: UserManagement },
  { path: '/ai-costs', title: 'AI 调用与成本', element: UserManagement },
  { path: '/files', title: '文件与 COS', element: UserManagement },
  { path: '/settings', title: '系统配置', element: UserManagement, requiredRole: 'ADMIN' },
  { path: '/audit', title: '审计日志', element: UserManagement, requiredRole: 'ADMIN' },
]
