import {NgModule} from '@angular/core';
import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
import {HomePage} from './home/home.page';
import {EastPage} from './east/east.page';
import {LoginPage} from './login/login.page';
import {Auth} from './service/auth';
import {AlarmPage} from './alarm/alarm.page';
import {RowPage} from './row/row.page';
import {IndexPage} from './index/index.page';
import {OtherPage} from './other/other.page';

const routes: Routes = [
    {
        path: '',
        canActivateChild: [Auth],
        children: [
            {path: '', redirectTo: 'index', pathMatch: 'full'},
            {path: 'home', component: HomePage},
            {path: 'east', component: EastPage},
            {path: 'other', component: OtherPage},
            {path: 'alarm', component: AlarmPage},
            {path: 'row', component: RowPage},
            {path: 'index', component: IndexPage}
        ]
    },
    {path: 'login', component: LoginPage}
];

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