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';
import {MinePage} from './mine/mine.page';
import {EnvFanPage} from './envCtrl/env-fan/env-fan.page';
import {EnvDetailPage} from './envCtrl/env-detail/env-detail.page';
import {EnvShowerPage} from './envCtrl/env-shower/env-shower.page';
import {EnvLightPageModule} from './envCtrl/env-light/env-light.module';
import {EnvLightPage} from './envCtrl/env-light/env-light.page';
import {EnvWaterchannelPage} from './envCtrl/env-waterchannel/env-waterchannel.page';
import {EnvAnalPage} from './envCtrl/env-anal/env-anal.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: 'mine', component: MinePage}
        ]
    },
    {path: 'login', component: LoginPage},
    // {path: 'env-detail',
    //     component: EnvDetailPage,
    //     children: [
    //         {path:'fan', component: EnvFanPage},
    //         {path:'shower', component: EnvShowerPage},
    //         {path:'light', component: EnvLightPage},
    //         {path:'waterchannel', component: EnvWaterchannelPage},
    //         {path: '', redirectTo: 'fan',pathMatch:'prefix'},
    //     ]
    // },
    // {path: 'tabs', loadChildren: './envCtrl/tabs/tabs.module#TabsPageModule'},
    // {path: 'd', component: EnvAnalPage},
];

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