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'
import QuickCreation from '@/views/quickCreation/index.vue'
import Agent from '@/views/agent/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: 'home/update-log',
        name: 'HomeUpdateLog',
        component: () => import('@/views/home/update-log.vue'),
        meta: { title: '更新日志', hidden: true }
      },
      {
        path: 'home/messages',
        name: 'HomeMessages',
        component: () => import('@/views/home/messages.vue'),
        meta: { title: '消息中心', hidden: true }
      }
    ]
  },
  {
    path: '/quickCreation',
    component: Layout,
    children: [
      {
        path: '',
        name: 'QuickCreation',
        component: QuickCreation,
        meta: { title: '快速创作', icon: 'add', affix: true }
      },
      {
        path: 'remove-watermark',
        name: 'RemoveWatermark',
        component: () => import('@/views/quickCreation/remove-watermark.vue'),
        meta: { title: '视频去水印', hidden: true }
      },
      {
        path: 'remove-subtitles',
        name: 'RemoveSubtitles',
        component: () => import('@/views/quickCreation/remove-subtitles.vue'),
        meta: { title: '视频去字幕', hidden: true }
      },
      {
        path: 'remove-quality',
        name: 'RemoveQuality',
        component: () => import('@/views/quickCreation/remove-quality.vue'),
        meta: { title: '视频画质增强', hidden: true }
      }
    ]
  },
  {
    path: '/agent',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Agent',
        component: Agent,
        meta: { title: 'Agent创作', icon: 'audio', affix: true }
      }
    ]
  },
  {
    path: '/zhibo',
    component: Layout,
    children: [
      {
        path: 'zhibo',
        alias: '',
        name: 'Zhibo',
        component: import('@/views/zhibo/index.vue'),
        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
