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

const routes: RouteRecordRaw[] = [
  {
    meta: { hideInMenu: true },
    name: 'AIKnowledgeLegacyRedirect',
    path: '/ai-platform/knowledge',
    redirect: '/ai-platform/knowledge-base',
  },
  {
    meta: { hideInMenu: true },
    name: 'AIKnowledgeLegacyDetailRedirect',
    path: '/ai-platform/knowledge/detail/:id',
    redirect: (to) => `/ai-platform/knowledge-base/detail/${to.params.id}`,
  },
  {
    meta: { hideInMenu: true },
    name: 'SubAppAIKnowledgeLegacyRedirect',
    path: '/app/:appCode/ai-platform/knowledge',
    redirect: (to) => `/app/${to.params.appCode}/ai-platform/knowledge-base`,
  },
  {
    meta: { hideInMenu: true },
    name: 'SubAppAIKnowledgeLegacyDetailRedirect',
    path: '/app/:appCode/ai-platform/knowledge/detail/:id',
    redirect: (to) =>
      `/app/${to.params.appCode}/ai-platform/knowledge-base/detail/${to.params.id}`,
  },
  {
    meta: {
      hideInMenu: true,
      title: '执行历史',
    },
    name: 'AIWorkflowRuns',
    path: '/ai-platform/workflow-runs',
    component: () => import('#/views/ai-platform/workflow-runs/index.vue'),
  },
  {
    meta: {
      hideInMenu: true,
      title: '执行历史',
    },
    name: 'SubAppAIWorkflowRuns',
    path: '/app/:appCode/ai-platform/workflow-runs',
    component: () => import('#/views/ai-platform/workflow-runs/index.vue'),
  },
  // 工作流编辑器 - 主应用
  {
    meta: {
      hideInMenu: true,
      title: '工作流编辑器',
      noBasicLayout: true,
    },
    name: 'AIWorkflowEditor',
    path: '/ai-platform/workflow/editor/:id',
    component: () => import('#/views/ai-platform/workflow/editor/index.vue'),
  },
  // 工作流编辑器 - 子应用
  {
    meta: {
      hideInMenu: true,
      title: '工作流编辑器',
      noBasicLayout: true,
    },
    name: 'SubAppAIWorkflowEditor',
    path: '/app/:appCode/ai-platform/workflow/editor/:id',
    component: () => import('#/views/ai-platform/workflow/editor/index.vue'),
  },
  // 智能体编辑器 - 主应用
  {
    meta: {
      hideInMenu: true,
      title: '智能体编辑器',
      noBasicLayout: true,
    },
    name: 'AIAgentEditor',
    path: '/ai-platform/agent/editor/:id',
    component: () => import('#/views/ai-platform/agent/editor/index.vue'),
  },
  // 智能体编辑器 - 子应用
  {
    meta: {
      hideInMenu: true,
      title: '智能体编辑器',
      noBasicLayout: true,
    },
    name: 'SubAppAIAgentEditor',
    path: '/app/:appCode/ai-platform/agent/editor/:id',
    component: () => import('#/views/ai-platform/agent/editor/index.vue'),
  },
  // 知识库详情 - 主应用
  {
    meta: {
      hideInMenu: true,
      title: '知识库详情',
    },
    name: 'AIKnowledgeDetail',
    path: '/ai-platform/knowledge-base/detail/:id',
    component: () => import('#/views/ai-platform/knowledge/detail/index.vue'),
  },
  // 知识库详情 - 子应用
  {
    meta: {
      hideInMenu: true,
      title: '知识库详情',
    },
    name: 'SubAppAIKnowledgeDetail',
    path: '/app/:appCode/ai-platform/knowledge-base/detail/:id',
    component: () => import('#/views/ai-platform/knowledge/detail/index.vue'),
  },
];

export default routes;
