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 {WestPage} from './west/west.component';
import {AlarmPage} from './alarm/alarm.page';
import {RowPage} from './row/row.page';
import {IndexPage} from './index/index.page';

const routes: Routes = [
    {
        path: '',
        canActivateChild: [Auth],
        children: [
            {path: '', redirectTo: 'index', pathMatch: 'full'},
            {path: 'home', component: HomePage},
            {path: 'east', component: EastPage},
            {path: 'west', component: WestPage},
            {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 {
}
