import type { AppRouteModule } from '@/router/types';

import { LAYOUT } from '@/router/constant';
import { t } from '@/hooks/web/useI18n';

const dashboard: AppRouteModule = {
  path: '/dashboard',
  name: 'Dashboard',
  component: LAYOUT,
  redirect: '/dashboard/analysis',
  meta: {
    orderNo: 10,
    icon: 'ion:grid-outline',
    title: t('routes.dashboard.dashboard'),
  },
  children: [
    {
      path: '/dashboard/analysis',
      name: 'Analysis',
      component: () => import('@/views/dashboard/analysis/index.vue'),
      meta: {
        // affix: true,
        title: t('routes.dashboard.analysis'),
      },
    },
    {
      path: '/formCallPage',
      name: 'formCallPage',
      meta: {
        title: '表单调用',
        hideMenu: true,
      },
      beforeEnter: (to: any, from: any, next: Function) => {
        to.meta.title = to.query.name;
        next();
      },
      component: () => import('@/views/demo/onlineform/formCall/index.vue'),
    },
    {
      path: 'scheme_preview/:id',
      name: 'SchemePreview',
      meta: {
        hideMenu: true,
        title: t('routes.demo.workflow.scheme_preview'),
        ignoreKeepAlive: true,
        showMenu: false,
        currentActiveMenu: '/workflow/scheme',
      },
      component: () => import('@/views/demo/workflow/scheme/preview.vue'),
    },
    {
      path: 'create_preview/:id',
      name: 'CreatePreview',
      meta: {
        hideMenu: true,
        title: t('routes.demo.workflow.create_preview'),
        ignoreKeepAlive: true,
        showMenu: false,
        currentActiveMenu: '/workflow/create',
      },
      component: () => import('@/views/demo/workflow/h5/create.vue'),
    },
    {
      path: 'task_audit_preview/:id',
      name: 'TaskAuditPreview',
      meta: {
        hideMenu: true,
        title: t('routes.demo.workflow.task_audit_preview'),
        ignoreKeepAlive: true,
        showMenu: false,
        currentActiveMenu: '/workflow/task',
      },
      component: () => import('@/views/demo/workflow/h5/audit.vue'),
    },
    {
      path: 'task_look_preview/:id',
      name: 'TaskLookPreview',
      meta: {
        hideMenu: true,
        title: t('routes.demo.workflow.task_look_preview'),
        ignoreKeepAlive: true,
        showMenu: false,
        currentActiveMenu: '/workflow/task',
      },
      component: () => import('@/views/demo/workflow/h5/look.vue'),
    },
  ],
};

export default dashboard;
