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

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

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

// 微前端路由
const moduleName = 'application';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/application',
    name: 'Application',
    meta: {
      title: '应用管理',
      icon: 'ant-design:appstore-outlined',
    },
    children: [
      {
        path: 'list',
        name: 'ApplicationList',
        meta: {
          title: '应用列表',
          keepAlive: false,
          icon: 'ant-design:list',
        },
        component: WujieVueRendererAdapter,
        props: (route) => {
          return {
            url: `${VITE_RENDERER_URL}`,
            accessToken: localStorage.getItem('y-code-access-token'),
            fileId: 'b91n1y9yr',
            projectId: LOW_CODE_PROJECT_ID,
            router,
            route,
            degrade: false,
            height: '100%',
          };
        },
      },
    ],
  },
];

export default routes;
