import { Routes } from '@angular/router';
import { journeyRouteGuard, userAdministrationRouteGuard } from './core/route-access.guards';

export const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    redirectTo: 'login'
  },
  {
    path: 'login',
    loadComponent: () => import('./login/login-page.component').then((m) => m.LoginPageComponent)
  },
  {
    path: 'demo-center',
    loadComponent: () => import('./demo/demo-center.component').then((m) => m.DemoCenterComponent)
  },
  {
    path: 'become/:prospectType',
    loadComponent: () => import('./public-onboarding/public-onboarding-page.component').then((m) => m.PublicOnboardingPageComponent)
  },
  {
    path: 'supplier',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('supplier')],
    data: { journeyId: 'supplier' }
  },
  {
    path: 'customer',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('customer')],
    data: { journeyId: 'customer' }
  },
  {
    path: 'internal',
    pathMatch: 'full',
    redirectTo: 'internal/operations-control'
  },
  {
    path: 'internal/islamic-finance',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('islamic-finance')],
    data: { journeyId: 'islamic-finance' }
  },
  {
    path: 'internal/accounting-office',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('accounting-office')],
    data: { journeyId: 'accounting-office' }
  },
  {
    path: 'internal/finance-approvals',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('finance-approvals')],
    data: { journeyId: 'finance-approvals' }
  },
  {
    path: 'internal/operations-control',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('operations-control')],
    data: { journeyId: 'operations-control' }
  },
  {
    path: 'internal/reporting-center',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('reporting-center')],
    data: { journeyId: 'reporting-center' }
  },
  {
    path: 'internal/workflow-monitoring',
    loadComponent: () => import('./journeys/journey-page.component').then((m) => m.JourneyPageComponent),
    canActivate: [journeyRouteGuard('workflow-monitoring')],
    data: { journeyId: 'workflow-monitoring' }
  },
  {
    path: 'internal/user-administration',
    loadComponent: () => import('./admin/user-administration-page.component').then((m) => m.UserAdministrationPageComponent),
    canActivate: [userAdministrationRouteGuard]
  },
  {
    path: 'islamic-finance',
    pathMatch: 'full',
    redirectTo: 'internal/islamic-finance'
  },
  {
    path: 'accounting-office',
    pathMatch: 'full',
    redirectTo: 'internal/accounting-office'
  },
  {
    path: 'finance-approvals',
    pathMatch: 'full',
    redirectTo: 'internal/finance-approvals'
  },
  {
    path: 'operations-control',
    pathMatch: 'full',
    redirectTo: 'internal/operations-control'
  },
  {
    path: 'reporting-center',
    pathMatch: 'full',
    redirectTo: 'internal/reporting-center'
  },
  {
    path: 'workflow-monitoring',
    pathMatch: 'full',
    redirectTo: 'internal/workflow-monitoring'
  },
  {
    path: '**',
    redirectTo: 'login'
  }
];
