import { Routes } from '@angular/router';
import { startPageGuard } from '@core';
import { authSimpleCanActivate, authSimpleCanActivateChild } from '@delon/auth';

import { DashboardComponent } from './dashboard/dashboard.component';
import { LayoutBasicComponent, LayoutBlankComponent } from '../layout';
import { DataVHomeComponent } from './data-v/home/home.component';
import { DataVWorkstationComponent } from './data-v/workstation/workstation.component';

export const routes: Routes = [
  {
    path: 'home',
    component: LayoutBasicComponent,
    canActivate: [startPageGuard, authSimpleCanActivate],
    canActivateChild: [authSimpleCanActivateChild],
    data: {},
    children: [
      { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
      { path: 'sys', loadChildren: () => import('./sys/routes').then(m => m.routes) }
    ]
  },
  {
    path: '',
    component: DataVHomeComponent,
    children: [
      { path: '', component: DataVWorkstationComponent },
      { path: 'data-v', loadChildren: () => import('./data-v/routes').then(m => m.routes) }
    ]
  },
  { path: '', loadChildren: () => import('./passport/routes').then(m => m.routes) },
  { path: 'exception', loadChildren: () => import('./exception/routes').then(m => m.routes) },
  { path: '**', redirectTo: 'exception/404' }
];
