import type { RouteRecordRaw } from 'vue-router';
import { RouteNames } from './router-constants';

const routes: RouteRecordRaw[] = [
  {
    path: '/', 
    component: () => import('src/layouts/main-layout.vue'),
    meta: { requiresAuth: true },
    children: [
      { 
        path: '', 
        name: RouteNames.DASHBOARD,
        component: () => import('src/pages/dashboard-page.vue'),
      },
      {
        path: 'timesheet-approvals',
        name: RouteNames.TIMESHEET_APPROVALS,
        component: () => import('src/pages/timesheet-approval-page.vue'),
      },
      {
        path: 'employees',
        name: RouteNames.EMPLOYEE_LIST,
        component: () => import('src/pages/employee-list-page.vue'),
      },
      {
        path: 'timesheet',
        name: RouteNames.TIMESHEET,
        component: () => import('src/pages/timesheet-page.vue')
      },
      {
        path: 'user/profile',
        name: RouteNames.PROFILE,
        component: () => import('src/pages/profile-page.vue'),
      },
    ],
  },

  {
    path: '/v1/login', 
    name: RouteNames.LOGIN,
    component: () => import('src/pages/login-page.vue'),
    meta: { requiresAuth: false },
  },

  {
    path: '/login-success', 
    name: RouteNames.LOGIN_SUCCESS,
    component: () => import('src/modules/auth/pages/auth-login-popup-success.vue'),
    meta: { requiresAuth: false },
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '/:catchAll(.*)*',
    component: () => import('src/pages/error-page.vue'),
    meta: { requiresAuth: false },
  },
];

export default routes;
