import Layout from "@/layout/index.vue";
import {
  HomeOutlined,
  BarChartOutlined,
  AppstoreOutlined,
} from "@ant-design/icons-vue";
import { h } from "vue";
import type { VNode, RendererNode, RendererElement } from "vue";

export interface RouteType {
  path: string;
  name: string;
  component?: any;
  meta: { title?: string };
  isMenu?: boolean;
  redirect?: string;
  children: RouteType[];
  icon?: () => VNode<
    RendererNode,
    RendererElement,
    {
      [key: string]: any;
    }
  >;
}

const routeList: RouteType[] = [
  {
    path: "/",
    name: "layout",
    component: Layout,
    meta: { title: "首页" },
    children: [
      {
        path: "",
        name: "-",
        meta: {},
        children: [],
        redirect: "/config-manage/project-cfg",
      },
      {
        path: "/config-manage",
        name: "config-manage",
        isMenu: true,
        meta: { title: "配置管理" },
        icon: () => h(HomeOutlined),
        children: [
          {
            path: "project-cfg",
            name: "project-cfg",
            component: () =>
              import("@/views/config-manage/project-cfg/index.vue"),
            meta: { title: "项目配置" },
            isMenu: true,
            children: [],
          },
          {
            path: "module-cfg",
            name: "module-cfg",
            component: () =>
              import("@/views/config-manage/module-cfg/index.vue"),
            meta: { title: "数据来源配置" },
            isMenu: true,
            children: [],
          },
        ],
      },
      {
        path: "/view-all-manage",
        name: "view-all-manage",
        isMenu: true,
        meta: { title: "视图管理" },
        icon: () => h(BarChartOutlined),
        children: [
          {
            path: "view-list",
            name: "view-list",
            component: () =>
              import("@/views/view-all-manage/view-list/index.vue"),
            meta: { title: "视图列表" },
            isMenu: true,
            children: [],
          },
          {
            path: "create-view",
            name: "create-view",
            component: () =>
              import("@/views/view-all-manage/create-view/index.vue"),
            meta: { title: "创建视图" },
            isMenu: true,
            children: [],
          },
        ],
      },
      {
        path: "/page-show-info",
        name: "page-show-info",
        isMenu: true,
        meta: { title: "视图预览" },
        icon: () => h(AppstoreOutlined),
        children: [
          {
            path: "page-info",
            name: "page-info",
            component: () =>
              import("@/views/page-show-info/page-info/index.vue"),
            meta: { title: "项目报表" },
            isMenu: true,
            children: [],
          },
        ],
      },
    ],
  },
];

export default routeList;
