import { createRouter, createWebHistory } from 'vue-router';
import Login from '../components/Login.vue';
import Register from '../components/Register.vue';
import PostDetail from '@/views/PostDetail.vue';
import MainPage from '@/views/MainPage.vue';
import UserPage from '@/views/UserPage.vue';
import NotificationList from '@/views/NotificationList.vue';

const routes = [
  {
    path: '/',
    name: 'MainPage',
    component: MainPage
  },
  {
    path: '/user/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/user/register',
    name: 'Register',
    component: Register
  },
  { 
    path: '/post/:id', 
    name: 'PostDetail', 
    component: PostDetail 
  },
  {
    path: '/user',
    name: 'UserPage',
    component: UserPage
  },
  {//通知页面
    path: '/notificationlist',
    name: 'NotificationList',
    component: NotificationList
  },
  {//详细通知页面
    path: '/notification/:id', 
    name: 'NotificationDetail',
    component: () => import('@/views/NotificationDetail.vue'),
    props: true
  }
];

const router = createRouter({
  history: createWebHistory(/*process.env.BASE_URL*/),
  routes
});

export default router; 