import { lazy } from "react";

export interface IRouteMenuItem {
  path: string;
  name: string;
}

interface IRoute extends IRouteMenuItem {
  element: React.LazyExoticComponent<() => JSX.Element>;
}

export const navRoutes: IRoute[] = [
  {
    path: "/overview",
    element: lazy(() => import("../view/Overview")),
    name: "总览",
  },
  {
    path: "/payment",
    element: lazy(() => import("../view/Payment")),
    name: "支付",
  },
];

export const sideMenuRoutes: IRoute[] = [
  {
    path: "/course/create",
    element: lazy(() => import("../view/Course/Create")),
    name: "创建课程",
  },
  {
    path: "/course/list",
    element: lazy(() => import("../view/Course/List")),
    name: "课程列表",
  },
  {
    path: "/course/library",
    element: lazy(() => import("../view/Course/Library")),
    name: "视频库",
  },
  {
    path: "/user",
    element: lazy(() => import("../view/User")),
    name: "用户",
  },
  {
    path: "/xcode",
    element: lazy(() => import("../view/XCode")),
    name: "邀请码",
  },
];

export const navMenuList = navRoutes.map((route) => {
  const { path: key, name: label } = route;
  return { key, label };
});
