import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Home from '@/views/home/index.vue'
import NotFound from '../views/NotFound.vue'
import VueFlow from '@/views/vue-flow/vueFlow.vue'
import Shili from '@/views/vue-flow/shili.vue'
import video from '@/views/vue-flow/video.vue'
import VideoOutMp4 from '@/views/vue-flow/components/VideoOutMp4.vue'
import ThreeD from '@/views/vue-flow/3d.vue'
import Layout from '@/layout/index.vue'
import Task from '@/views/task/index.vue'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: 'home',
        alias: '',
        name: 'Home',
        component: Home,
        meta: { title: '首页', icon: 'House', affix: true }
      }
    ]
  },
  {
    path: '/task',
    component: Layout,
    children: [
      {
        path: 'task',
        alias: '',
        name: 'Task',
        component: Task,
        meta: { title: '任务协作', icon: 'House', affix: true }
      }
    ]
  },
  {
    path: '/resource',
    component: Layout,
    children: [
      {
        path: 'clip',
        name: 'Clip',
        component: ()=> import('@/views/resource/clip/index.vue'),
        meta: { title: '成片管理', icon: '', affix: true }
      },
      {
        path: 'clip/detail/:id',  // 动态参数 :id
        name: 'ClipDetail',
        component: ()=> import('@/views/resource/clip/detail.vue'),
        meta: { title: '成片详情', hidden: true } // hidden: true 表示不在左侧菜单显示
      },
      {
        path: 'material',
        name: 'Material',
        component: ()=> import('@/views/resource/material/index.vue'),
        meta: { title: '素材管理', icon: '', affix: true }
      },
      {
        path: 'material/detail/:id',  // 动态参数 :id
        name: 'MaterialDetail',
        component: ()=> import('@/views/resource/material/detail.vue'),
        meta: { title: '素材详情', hidden: true } // hidden: true 表示不在左侧菜单显示
      },
      {
        path: 'script',
        name: 'Template',
        component: ()=> import('@/views/resource/script/index.vue'),
        meta: { title: '脚本管理', icon: '', affix: true }
      },
      {
        path: 'image',
        name: 'Image',
        component: ()=> import('@/views/resource/image/index.vue'),
        meta: { title: '图片管理', icon: '', affix: true }
      },
      {
        path: 'image/detail/:id',  // 动态参数 :id
        name: 'ImageDetail',
        component: ()=> import('@/views/resource/image/detail.vue'),
        meta: { title: '图片详情', hidden: true } // hidden: true 表示不在左侧菜单显示
      },
      {
        path: 'audio',
        name: 'Audio',
        component: ()=> import('@/views/resource/audio/index.vue'),
        meta: { title: '音频管理', icon: '', affix: true }
      },
      {
        path: 'audio/detail/:id',  // 动态参数 :id
        name: 'AudioDetail',
        component: ()=> import('@/views/resource/audio/detail.vue'),
        meta: { title: '音频详情', hidden: true } // hidden: true 表示不在左侧菜单显示
      },
    ]
  },
  {
    path: '/analysis',
    component: Layout,
    children: [
      {
        path: 'video',
        name: 'VideoData',
        component: ()=> import('@/views/analysis/video.vue'),
        meta: { title: '视频数据分析', icon: '', affix: true }
      },
      {
        path: 'ad',
        name: 'AdData',
        component: ()=> import('@/views/analysis/ad.vue'),
        meta: { title: '广告账户分析', icon: '', affix: true }
      },
      {
        path: 'department',
        name: 'DepartmentData',
        component: ()=> import('@/views/analysis/department.vue'),
        meta: { title: '部门分析', icon: '', affix: true }
      },
    ]
  },


  {
    path: '/vueFlow/:projectId?',
    name: 'VueFlow',
    component: VueFlow
  },
  {
    path: '/shili',
    component: Layout,
    children: [
      {
        path: '/shili',
        name: 'Shili',
        component: Shili
      }
    ]
  },
  {
    path: '/video',
    component: Layout,
    children: [
      {
        path: '/video',
        name: 'video',
        component: video
      }
    ]
  },
  {
    path: '/video1',
    component: Layout,
    children: [
      {
        path: '/video1',
        name: 'VideoOutMp4',
        component: VideoOutMp4
      }
    ]
  },
  {
    path: '/3d',
    component: Layout,
    children: [
      {
        path: '/3d',
        name: 'ThreeD',
        component: ThreeD
      }
    ]
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: NotFound
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
