import { NgModule } from '@angular/core';
import { Routes } from '@angular/router';
import { NativeScriptRouterModule } from '@nativescript/angular';
import { AuthGuard } from '~/core/services/auth-guard.service';

const routes: Routes = [
    { path: '', redirectTo: '/home', pathMatch: 'full' },
    {
        path: 'login',
        loadChildren: () => import('./pages/login/login.module').then(m => m.LoginModule)
    },
    {
        path: 'home',
        loadChildren: () => import('./pages/home/home.module').then(m => m.HomeModule)
    },
    {
        path: 'message',
        loadChildren: () => import('./pages/message/message.module').then(m => m.MessageModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'search',
        loadChildren: () => import('./pages/search-person/search-person.module').then(m => m.SearchPersonModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'sts',
        loadChildren: () => import('./pages/sts/sts.module').then(m => m.StsModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'material',
        loadChildren: () => import('./pages/material/material.module').then(m => m.MaterialModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'unit',
        loadChildren: () => import('./pages/unit/unit.module').then(m => m.UnitModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'event',
        loadChildren: './pages/event/event.module#EventModule',
        canActivate: [AuthGuard]
    },
    {
        path: 'evaluation',
        loadChildren: () => import('./pages/evaluation/evaluation.module').then(m => m.EvaluationModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'application',
        loadChildren: () => import('./pages/application/application.module').then(m => m.ApplicationModule),
        canActivate: [AuthGuard]
    },
    {
        path: 'export',
        loadChildren: () => import('./pages/export/export.module').then(m => m.ExportModule),
        canActivate: [AuthGuard]

    },
    {
        path: 'advertising',
        loadChildren: () => import('./pages/advertising/advertising.module').then(m => m.AdvertisingModule),
        canActivate: [AuthGuard]

    },
    {
        path: 'about',
        loadChildren: () => import('./pages/about/about.module').then(m => m.AboutModule)
    }
];

@NgModule({
    imports: [NativeScriptRouterModule.forRoot(routes)],
    exports: [NativeScriptRouterModule]
})
export class AppRoutingModule {
}
