const emailRouteComponent = () => import('@/pages/apps/email/index.vue')

// 👉 Redirects
export const redirects = [
  // ℹ️ We are redirecting to different pages based on role.
  // NOTE: Role is just for UI purposes. ACL is based on abilities.
  {
    path: '/',
    name: 'index',
    redirect: to => {
      // TODO: Get type from backend
      const userData = useCookie('userData')
      const userRole = userData.value?.role
      if (userRole === 'admin')
        return { name: 'admin-dashboard' }
      if (userRole === 'client')
        return { name: 'access-control' }
      
      return { name: 'login', query: to.query }
    },
  },
  {
    path: '/pages/user-profile',
    name: 'pages-user-profile',
    redirect: () => ({ name: 'pages-user-profile-tab', params: { tab: 'profile' } }),
  },
  {
    path: '/pages/account-settings',
    name: 'pages-account-settings',
    redirect: () => ({ name: 'pages-account-settings-tab', params: { tab: 'account' } }),
  },
  
]
export const routes = [
  // Email filter
  {
    path: '/admin/dashboard',
    name: 'admin-dashboard',
    component: () => import('@/pages/dashboards/analytics.vue'),
  },
  {
    path: '/admin/patients',
    name: 'admin-patients',
    component: () => import('@/pages/patients/patients.vue'),
  },
  {
    path: '/admin/patients/labkit/:patient_id',
    name: 'admin-patients-labkit',
    component: () => import('@/pages/pages/patient-labkits/labkit.vue'),
  },
  {
    path: '/admin/patient/meetings/:id',
    name: 'admin-patient-meeitngs',
    component: () => import('@/pages/patients/meetings.vue'),
  },
  {
    path: '/admin/patient/meeting-details/:patient_id/:id',
    name: 'admin-patient-meeitng-details',
    component: () => import('@/pages/patients/meeting-details.vue'),
  },
  {
    path: '/admin/provider/meetings/:id',
    name: 'admin-provider-meeitngs',
    component: () => import('@/pages/providers/meetings.vue'),
  },
  {
    path: '/admin/provider/meeting-details/:provider_id/:id',
    name: 'admin-provider-meeitng-details',
    component: () => import('@/pages/providers/meeting-details.vue'),
  },
  {
    path: '/admin/patient/meeting/prescription/:patient_id/:id',
    name: 'admin-patient-meeitng-prescription',
    component: () => import('@/pages/pages/patient-meetings/prescription.vue'),
  },
  {
    path: '/admin/patient/meeting/notes/:patient_id/:id',
    name: 'admin-patient-meeitng-notes',
    component: () => import('@/pages/pages/patient-meetings/notes.vue'),
  },
  {
    path: '/admin/providers',
    name: 'admin-providers',
    component: () => import('@/pages/providers/providers.vue'),
  },
  {
    path: '/admin/labs',
    name: 'admin-labs',
    component: () => import('@/pages/labs/labs.vue'),
  },
  {
    path: '/admin/lab-kites',
    name: 'admin-lab-kites',
    component: () => import('@/pages/labs/labs-kit.vue'),
  },
  {
    path: '/admin/medicines',
    name: 'admin-medicines',
    component: () => import('@/pages/medicines/medicines.vue'),
  },
   {
    path: '/admin/profile',
    name: 'admin-profile',
    component: () => import('@/views/pages/account-settings/AccountSettingsAccount.vue'),
  },
  {
    path: '/admin/change-password',
    name: 'admin-change-password',
    component: () => import('@/views/pages/account-settings/AccountSettingsSecurity.vue'),
  },
   {
    path: '/admin/site-setting',
    name: 'admin-site-setting',
    component: () => import('@/views/pages/account-settings/WebsiteSettings.vue'),
  },
   {
    path: '/admin/patients/patient-profile/:id',
    name: 'admin-patient-profile',
     component: () => import('@/pages/patients/patient-profile.vue'),
  },
   {
    path: '/admin/provider/provider-profile/:id',
    name: 'admin-provider-profile',
     component: () => import('@/pages/providers/provider-profile.vue'),
  },
  {
    path: '/admin/providers/patientprofile/:patient_id',
    name: 'admin-providers-patientprofile',
    component: () => import('@/pages/patients/patientprofile.vue'),
  },
  {
    path: '/apps/email/filter/:filter',
    name: 'apps-email-filter',
    component: emailRouteComponent,
    meta: {
      navActiveLink: 'apps-email',
      layoutWrapperClasses: 'layout-content-height-fixed',
    },
  },

  // Email label
  {
    path: '/apps/email/label/:label',
    name: 'apps-email-label',
    component: emailRouteComponent,
    meta: {
      // contentClass: 'email-application',
      navActiveLink: 'apps-email',
      layoutWrapperClasses: 'layout-content-height-fixed',
    },
  },
  {
    path: '/dashboards/logistics',
    name: 'dashboards-logistics',
    component: () => import('@/pages/apps/logistics/dashboard.vue'),
  },
  {
    path: '/dashboards/academy',
    name: 'dashboards-academy',
    component: () => import('@/pages/apps/academy/dashboard.vue'),
  },
  {
    path: '/apps/ecommerce/dashboard',
    name: 'apps-ecommerce-dashboard',
    component: () => import('@/pages/dashboards/ecommerce.vue'),
  },
]
