// 定义静态路由
import NotFound from '@/pages/notFound'
import mapRoutes from '@/router-handle/mapRoutes'
import { Navigate, RouteObject } from 'react-router-dom'
const syncRoutes: MyRouteObject[] = [
  {
    path: '/',
    element: <Navigate to={'/login'} />,
    errorElement: <div></div>
  },
  {
    path: '/login',
    lazy: async () => {
      const Login = await import('@/pages/login')
      return {
        Component: Login.default
      }
    }
  },
  {
    path: '/home',
    children: [...mapRoutes()],
    lazy: async () => {
      const Home = await import('@/pages/home')
      return {
        Component: Home.default
      }
    }
  },
  {
    path: '*',
    element: <NotFound />
  }
]

export type MyRouteObject = Omit<RouteObject, 'children'> & {
  name?: string
  icon?: any
  highIcon?: any
  children?: MyRouteObject[]
}

export default syncRoutes
