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

import Layout from '@/components/Layout.vue';
import AlertChart from '@/components/AlertChart.vue';
import Statistics from '@/components/Statistics.vue';
import AlertManagement from '@/html/AlertManagement.vue';
import Test from '@/html/Test.vue';
import Login from '@/html/LoginView.vue';
import UserList from '@/html/UserList.vue';
import Home from '@/html/Home.vue';
import DataStatistics from '@/html/DataStatistics.vue';
import Cameras from '@/components/Cameras.vue';
import Settings from '@/components/Settings.vue';
import ViewList from '@/html/ViewList.vue';

const routes = [
    {
        path: '/',
        name: 'Layout',
        component: Layout,
        meta: { requiresAuth: true }, 
        children: [
            {
                path: '',
                name: 'Home',
                component: Home,
                meta: { requiresAuth: true } 
            },
            {
                path: '/alertManagement',
                name: 'AlertManagement',
                component: AlertManagement,
                meta: { requiresAuth: true } 
            },
            {
                path: '/test',
                name: 'Test',
                component: Test,
                meta: { requiresAuth: true } 
            },
            {
                path: '/alertChart',
                name: 'AlertChart',
                component: AlertChart,
                meta: { requiresAuth: true } 
            },
            {
                path: '/statistics',
                name: 'Statistics',
                component: Statistics,
                meta: { requiresAuth: true } 
            },
            {
                path:'/userList',
                name: 'UserList',
                component: UserList,
                meta: { requiresAuth: true }
            },
            {
                path:'/dataStatistics',
                name: 'DataStatistics',
                component: DataStatistics,
                meta: { requiresAuth: true }
            },
            {
                path:'/cameras',
                name: 'Cameras',
                component: Cameras,
                meta: { requiresAuth: true }
            },
            {
                path:'/settings',
                name: 'Settings',
                component: Settings,
                meta: { requiresAuth: true }
            },
            {
                path:'/viewList',
                name: 'ViewList',
                component: ViewList,
                meta: { requiresAuth: true }
            }
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: Login,
        meta: { requiresAuth: false } 
    }
];

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

export default router;
