import { createRouter, createWebHistory } from 'vue-router'
import LoginView from './views/LoginView.vue'
import ProjectDetailView from './views/ProjectDetailView.vue'
import SettingsView from './views/SettingsView.vue'
import MemoryView from './views/MemoryView.vue'
import DocsView from './views/DocsView.vue'
import AgentDetailView from './views/AgentDetailView.vue'
import AgentsIndexView from './views/AgentsIndexView.vue'
import SecurityView from './views/SecurityView.vue'
import IncidentsView from './views/IncidentsView.vue'
import CalendarView from './views/CalendarView.vue'
import NexusLayout from './layouts/NexusLayout.vue'
import FlowBoard from './views/Dashboard/FlowBoard.vue'
import TaskBoardView from './views/TaskBoardView.vue'
import TaskDetailView from './views/TaskDetailView.vue'
import NotificationsView from './views/NotificationsView.vue'

const routes = [
  { path: '/login', name: 'Login', component: LoginView, meta: { public: true } },
  { path: '/', redirect: '/dashboard' },

  // V2 Dashboard (neues NexusLayout + FlowBoard)
  {
    path: '/dashboard',
    component: NexusLayout,
    children: [
      { path: '', name: 'Dashboard', component: FlowBoard },
    ],
  },

  { path: '/memory', name: 'Memory', component: MemoryView },
  { path: '/docs', name: 'Docs', component: DocsView },
  { path: '/agents/:id', name: 'AgentDetail', component: AgentDetailView },
  { path: '/security', name: 'Security', component: SecurityView },
  { path: '/incidents', name: 'Incidents', component: IncidentsView },
  { path: '/calendar', name: 'Calendar', component: CalendarView },
  { path: '/projects', name: 'Projects', component: { template: '' } },
  { path: '/projects/:id', name: 'ProjectDetail', component: ProjectDetailView },
  { path: '/tasks', name: 'Task Board', component: TaskBoardView },
  { path: '/tasks/:id', name: 'TaskDetail', component: TaskDetailView },
  { path: '/agents', name: 'Agents', component: AgentsIndexView },
  { path: '/models', name: 'Models', component: { template: '' } },
  { path: '/activity', name: 'Activity', component: { template: '' } },
  { path: '/chat', name: 'Mobile Chat', component: { template: '' } },
  { path: '/notifications', name: 'Notifications', component: NotificationsView },
  { path: '/settings', name: 'Settings', component: SettingsView },
  { path: '/:pathMatch(.*)*', redirect: '/dashboard' },
]

export default createRouter({
  history: createWebHistory(),
  routes,
})
