import { createRouter, createWebHistory } from 'vue-router'

// Views
import Home from '@/views/Home.vue'
import Login from '@/views/Login.vue'
import Register from '@/views/Register.vue'
import Events from '@/views/Events.vue'
import EventDetail from '@/views/EventDetail.vue'
import Albums from '@/views/Albums.vue'
import AlbumDetail from '@/views/AlbumDetail.vue'
import Vlogs from '@/views/Vlogs.vue'
import VlogDetail from '@/views/VlogDetail.vue'
import Posts from '@/views/Posts.vue'
import Profile from '@/views/Profile.vue'
import UserProfile from '@/views/UserProfile.vue'
import Stats from '@/views/Stats.vue'
import Admin from '@/views/Admin.vue'
import Information from '@/views/Information.vue'
import MyTickets from '@/views/MyTickets.vue'


const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: { requiresAuth: true }
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
    meta: { layout: 'auth' }
  },
  {
    path: '/register',
    name: 'Register',
    component: Register,
    meta: { layout: 'auth' }
  },
  {
    path: '/events',
    name: 'Events',
    component: Events,
    meta: { requiresAuth: true }
  },
  {
    path: '/events/:id',
    name: 'EventDetail',
    component: EventDetail,
    meta: { requiresAuth: true }
  },
  {
    path: '/albums',
    name: 'Albums',
    component: Albums,
    meta: { requiresAuth: true }
  },
  {
    path: '/albums/:id',
    name: 'AlbumDetail',
    component: AlbumDetail,
    meta: { requiresAuth: true }
  },
  {
    path: '/vlogs',
    name: 'Vlogs',
    component: Vlogs,
    meta: { requiresAuth: true }
  },
  {
    path: '/vlogs/:id',
    name: 'VlogDetail',
    component: VlogDetail,
    meta: { requiresAuth: true }
  },
  {
    path: '/posts',
    name: 'Posts',
    component: Posts,
    meta: { requiresAuth: true }
  },
  {
    path: '/profile',
    name: 'Profile',
    component: Profile,
    meta: { requiresAuth: true }
  },
  {
    path: '/profile/:id',
    name: 'UserProfile',
    component: UserProfile,
    meta: { requiresAuth: true }
  },
  {
    path: '/stats',
    name: 'Stats',
    component: Stats,
    meta: { requiresAuth: true }
  },
  {
    path: '/admin',
    name: 'Admin',
    component: Admin,
    meta: { requiresAuth: true, requiresAdmin: true }
  },
  {
    path: '/information',
    name: 'Information',
    component: Information,
    meta: { requiresAuth: true }
  },
  {
    path: '/my-tickets',
    name: 'MyTickets',
    component: MyTickets,
    meta: { requiresAuth: true }
  }

]

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

// Navigation guard simplifié - la logique d'authentification sera gérée dans les composants
router.beforeEach((to, from, next) => {
  // Pour l'instant, on laisse passer toutes les routes
  // La logique d'authentification sera gérée dans les composants individuels
  next()
})

export default router
