/**
 * Configuration du router Vue Router pour IPWatch
 * Gère la navigation entre la page principale et la page de suivi
 */
import { createRouter, createWebHistory } from 'vue-router'
import MainView from '@/views/MainView.vue'
import TrackingView from '@/views/TrackingView.vue'
import ArchitectureView from '@/views/ArchitectureView.vue'
import TestView from '@/views/TestView.vue'
import ServicesView from '@/views/ServicesView.vue'

const routes = [
  {
    path: '/',
    name: 'main',
    component: MainView,
    meta: {
      title: 'IPWatch - Scanner réseau'
    }
  },
  {
    path: '/tracking',
    name: 'tracking',
    component: TrackingView,
    meta: {
      title: 'IPWatch - Équipements suivis'
    }
  },
  {
    path: '/architecture',
    name: 'architecture',
    component: ArchitectureView,
    meta: {
      title: 'IPWatch - Architecture réseau'
    }
  },
  {
    path: '/services',
    name: 'services',
    component: ServicesView,
    meta: {
      title: 'IPWatch - Ports & Services'
    }
  },
  {
    path: '/test',
    name: 'test',
    component: TestView,
    meta: {
      title: 'IPWatch - Tests réseau'
    }
  }
]

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

// Mise à jour du titre de page
router.beforeEach((to, from, next) => {
  document.title = to.meta.title || 'IPWatch'
  next()
})
