import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AdminLayout } from './admin-layout.component';
import { AuthGuard } from './auth/auth.guard';

const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: '/pages/my' },
  { path: 'auth', loadChildren: () => import('./pages/auth/auth.module').then(m => m.AuthModule) },
  { path: 'art', loadChildren: () => import('./pages/art/art.module').then(m => m.ArtModule) },
  { path: 'webgl', loadChildren: () => import('./pages/webgl/webgl.module').then(m => m.WebglModule) },

  {
    canActivate: [AuthGuard],
    path: '',
    component: AdminLayout,
    children: [
      { path: 'pages', loadChildren: () => import('./pages/page/page.module').then(m => m.PageModule) },
      { path: 'score', loadChildren: () => import('./pages/score/score.module').then(m => m.ScoreModule) },
      { path: 'sys', loadChildren: () => import('./pages/sys/sys.module').then(m => m.SysModule) },
      { path: 'system', loadChildren: () => import('./pages/sys/sys.module').then(m => m.SysModule) },
      { path: 'content', loadChildren: () => import('./pages/content/content.module').then(m => m.ContentModule) },
      { path: 'coloring', loadChildren: () => import('./projs/coloring/coloring.module').then(m => m.ColoringModule) },
    ],
  }

];

@NgModule({
  imports: [RouterModule.forRoot(routes,
    {
      //scrollPositionRestoration: 'enabled',
      //anchorScrolling: "enabled",
    }
  )],
  exports: [RouterModule]
})
export class AppRoutingModule { }
