import { createRouter, createWebHistory } from 'vue-router';
import Register from './views/Register.vue';
import Login from './views/Login.vue';
import Activate from './views/Activate.vue';
import ForgotPassword from './views/ForgotPassword.vue';
import ResetPassword from './views/ResetPassword.vue';
import Home from './views/Home.vue';
import CreateClub from './views/CreateClub.vue';
import ClubView from './views/ClubView.vue';
import MembersView from './views/MembersView.vue';
import DiaryView from './views/DiaryView.vue';
import PendingApprovalsView from './views/PendingApprovalsView.vue';
import ScheduleView from './views/ScheduleView.vue';
import TournamentsView from './views/TournamentsView.vue';
import OfficialTournaments from './views/OfficialTournaments.vue';
import TrainingStatsView from './views/TrainingStatsView.vue';
import ClubSettings from './views/ClubSettings.vue';
import PredefinedActivities from './views/PredefinedActivities.vue';
import MyTischtennisAccount from './views/MyTischtennisAccount.vue';
import ClickTtAccount from './views/ClickTtAccount.vue';
import TeamManagementView from './views/TeamManagementView.vue';
import PermissionsView from './views/PermissionsView.vue';
import LogsView from './views/LogsView.vue';
import ClickTtView from './views/ClickTtView.vue';
import MemberTransferSettingsView from './views/MemberTransferSettingsView.vue';
import PersonalSettings from './views/PersonalSettings.vue';
import Impressum from './views/Impressum.vue';
import Datenschutz from './views/Datenschutz.vue';
import { applySeoForPath } from './utils/seo.js';

const routes = [
  { path: '/register', name: 'register', component: Register },
  { path: '/login', name: 'login', component: Login },
  { path: '/activate/:activationCode', name: 'activate', component: Activate },
  { path: '/forgot-password', name: 'forgot-password', component: ForgotPassword },
  { path: '/reset-password/:token', name: 'reset-password', component: ResetPassword },
  { path: '/', name: 'home', component: Home },
  { path: '/createclub', name: 'create-club', component: CreateClub },
  { path: '/showclub/:clubId', name: 'show-club', component: ClubView },
  { path: '/members', name: 'members', component: MembersView },
  { path: '/diary', name: 'diary', component: DiaryView },
  { path: '/pending-approvals', name: 'pending-approvals', component: PendingApprovalsView},
  { path: '/schedule', name: 'schedule', component: ScheduleView},
  { path: '/tournaments', name: 'tournaments', component: TournamentsView },
  { path: '/tournament-participations', name: 'tournament-participations', component: OfficialTournaments },
  { path: '/training-stats', name: 'training-stats', component: TrainingStatsView },
  { path: '/club-settings', name: 'club-settings', component: ClubSettings },
  { path: '/predefined-activities', name: 'predefined-activities', component: PredefinedActivities },
  { path: '/mytischtennis-account', name: 'mytischtennis-account', component: MyTischtennisAccount },
  { path: '/clicktt-account', name: 'clicktt-account', component: ClickTtAccount },
  { path: '/team-management', name: 'team-management', component: TeamManagementView },
  { path: '/permissions', name: 'permissions', component: PermissionsView },
  { path: '/logs', name: 'logs', component: LogsView },
  { path: '/clicktt', name: 'clicktt', component: ClickTtView },
  { path: '/member-transfer-settings', name: 'member-transfer-settings', component: MemberTransferSettingsView },
  { path: '/personal-settings', name: 'personal-settings', component: PersonalSettings },
  { path: '/impressum', name: 'impressum', component: Impressum },
  { path: '/datenschutz', name: 'datenschutz', component: Datenschutz },
];

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

router.afterEach((to) => {
  applySeoForPath(to.path);
});

export default router;
