import type { RouteRecordRaw } from 'vue-router'

const Layout = () => import('@/layouts/index.vue')

const routes: RouteRecordRaw[] = [
  {
    path: '/app-center',
    component: Layout,
    redirect: '/app-center/store',
    name: 'app_center',
    meta: {
      title: '应用商店',
      icon: 'ri:function-line',
    },
    children: [
      {
        path: 'store',
        name: 'appStore',
        component: () => import('@/views/app_center/app_store/index.vue'),
        meta: {
          title: '应用商店',
          sidebar: false,
          breadcrumb: false,
          activeMenu: '/app-center',
        },
      },
      {
        path: 'app/permit/:appId',
        name: 'appPermit',
        component: () => import('@/views/app_center/permit/index.vue'),
        meta: {
          title: '配置应用权限',
          sidebar: false,
          activeMenu: '/app-center/store',
          cache: true,
          noCache: 'appPermit',
        },
      },
      {
        path: 'app/publish/:id',
        name: 'appPublish',
        component: () => import('@/views/app_center/publish/index.vue'),
        meta: {
          title: '应用发布',
          sidebar: false,
          activeMenu: '/app-center/store',
          cache: true,
          noCache: 'appPublish',
        },
      },
    ],
  },
  {
    path: '/app-center/publish',
    component: Layout,
    redirect: '/app-center/publish/index',
    name: 'appPublish',
    meta: {
      title: '应用发布',
      icon: 'bx:bxs-component',
    },
    children: [
      {
        path: 'index',
        name: 'appPublishIndex',
        component: () => import('@/views/app_center/publish/index.vue'),
        meta: {
          title: '应用发布',
          sidebar: false,
          breadcrumb: false,
          activeMenu: '/app-center/publish',
        },
      },
    ],
  },
  {
    path: '/app-center/removed',
    component: Layout,
    redirect: '/app-center/removed/index',
    name: 'appRemoved',
    meta: {
      title: '已下架',
      icon: 'ep:delete',
    },
    children: [
      {
        path: 'index',
        name: 'appRemovedIndex',
        component: () => import('@/views/app_center/removed/index.vue'),
        meta: {
          title: '已下架',
          sidebar: false,
          breadcrumb: false,
          activeMenu: '/app-center/removed',
        },
      },
    ],
  },
]
export default routes
