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'

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: '/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: 'audio',
        name: 'Audio',
        component: ()=> import('@/views/resource/audio/index.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
