import type { RouteRecordRaw } from 'vue-router';

import WujieVueRendererAdapter from '@sy/wujie-vue3-renderer-adapter';

import { LOW_CODE_PROJECT_ID, VITE_RENDERER_URL } from '#/constants';

const moduleName = 'acl';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/acl',
    name: moduleName,
    redirect: '/acl/list',
    meta: {
      title: '用户管理',
      icon: 'ant-design:user-outlined',
    },
    children: [
      {
        path: 'list',
        name: 'AclList',
        meta: {
          hideInMenu: true,
          title: '权限列表',
          keepAlive: true,
          icon: 'ant-design:list',
        },
        component: WujieVueRendererAdapter,
        props: {
          url: `${VITE_RENDERER_URL}`,
          accessToken: localStorage.getItem('y-code-access-token'),
          fileId: '1hsd0407hf',
          projectId: LOW_CODE_PROJECT_ID,
          degrade: false,
        },
      },
      {
        path: 'user',
        name: 'AclUser',
        meta: {
          title: '用户列表',
          keepAlive: true,
          icon: 'ant-design:list',
        },
        component: WujieVueRendererAdapter,
        props: {
          url: `${VITE_RENDERER_URL}`,
          accessToken: localStorage.getItem('y-code-access-token'),
          fileId: '7pfu5radx',
          projectId: LOW_CODE_PROJECT_ID,
          degrade: false,
        },
      },
    ],
  },
];

export default routes;
