import { Routes } from '@angular/router';
import {InitGuardService} from "./utils/initGuard.service";
import {NavigationComponent} from "./pages/navigation/navigation.component";
import {Error404Component} from "./pages/common/error/error404/error404.component";
export const routes: Routes = [
  {path: '', pathMatch: 'full', redirectTo: '/login'},
  {
    path: 'login',
    loadChildren: () => import('./pages/login/login-routing.module').then(m => m.LOGIN_ROUTES)
  },
  {
    path: 'admin', component: NavigationComponent,
    children: [
      {
        path: 'index',
        loadChildren: () => import('./pages/index/index-routing.module').then(m => m.INDEX_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'device',
        loadChildren: () => import('./pages/device/device-routing.module').then(m => m.DEVICE_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'pay-qrCode',
        loadChildren: () => import('./pages/pay-qr-code/pay-qr-code-routing.module').then(m => m.PAY_QR_CODE_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'company',
        loadChildren: () => import('./pages/company/company-routing.module').then(m => m.COMPANY_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'agent',
        loadChildren: () => import('./pages/agent/agent-routing.module').then(m => m.AGENT_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'store',
        loadChildren: () => import('./pages/store/store-routing.module').then(m => m.STORE_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'mer',
        loadChildren: () => import('./pages/mer/mer-routing.module').then(m => m.MER_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'trade-order',
        loadChildren: () => import('./pages/trade-order/trade-order-routing.module').then(m => m.TRADE_ORDER_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'trade-checking',
        loadChildren: () => import('./pages/trade-checking/trade-checking-routing.module').then(m => m.TRADE_CHECKING_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'store-device',
        loadChildren: () => import('./pages/store-device/store-device-routing.module').then(m => m.STORE_DEVICE_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'store-discount-activity',
        loadChildren: () => import('./pages/store-discount-activity/store-discount-activity-routing.module').then(m => m.STORE_DISCOUNT_ACTIVITY_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'salesman',
        loadChildren: () => import('./pages/salesman/salesman-routing.module').then(m => m.SALESMAN_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'platform',
        loadChildren: () => import('./pages/platform/platform-routing.module').then(m => m.PLATFORM_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'profit-sharing',
        loadChildren: () => import('./pages/trade-order-profit-sharing/trade-order-profit-sharing-routing.module').then(m => m.TRADE_ORDER_PROFIT_SHARING_ROUTES),
        canActivate: [InitGuardService]
      },
      {
        path: 'system',
        loadChildren: () => import('./pages/system/system-routing.module').then(m => m.SYSTEM_ROUTES),
        canActivate: [InitGuardService]
      },
   /*   {
        path: 'cms',
        loadChildren: () => import('./pages/cms/cms.module').then(m => m.CmsModule),
        canActivate: [InitGuardService]
      },*/
      {
        path: 'activity-money',
        loadChildren: () => import('./pages/activity-money/activity-money-routing.module').then(m => m.ACTIVITY_MONEY_ROUTES),
        canActivate: [InitGuardService]
      },
    ]
  },
/*  {
    path: 'error',
    loadChildren: () => import('./pages/error/error.routes').then(m => m.ERROR_ROUTES),
  },*/
  {
    path: '**', component: Error404Component
  },
];
