import { NgModule } from '@angular/core';
import { Route, RouterModule } from '@angular/router';
import { environment } from '../../environments/environment';
import { LayoutComponent } from '../layout/layout.component';
import { SharedModule } from '../shared/shared.module';
import { NotFoundComponent } from './404/404.component';
import { HomeComponent } from './home/home.component';
// import { ResourcesComponent } from './resources/resources.component';

const COMPONENTS = [HomeComponent, NotFoundComponent];

const routes: Route[] = [
  {
    path: 'idea',
    loadChildren: () => import('./idea/idea.module').then(m => m.IdeaModule)
  },
  {
    path: '',
    component: LayoutComponent,
    children: [
      // { path: '', redirectTo: 'zh', pathMatch: 'full' },
      { path: 'zh', component: HomeComponent, data: { titleI18n: 'slogan' } },
      { path: 'en', component: HomeComponent, data: { titleI18n: 'slogan' } },
      {path: 'resources', loadChildren: () => import('./resources/resources.module').then(m => m.ResourcesModule)},
      // #region region routers
      { path: 'docs', loadChildren: () => import('./gen/docs/docs.module').then(m => m.DocsModule) },
      {
        path: 'core',
        loadChildren: () => import('./gen/core/core.module').then(m => m.CoreModule)
      },
      // {
      //   path: 'layout',
      //   loadChildren: () => import('./gen/layout/layout.module').then(m => m.LayoutModule)
      // },
      // {
      //   path: 'theme',
      //   loadChildren: () => import('./gen/theme/theme.module').then(m => m.ThemeModule)
      // },
      { path: 'auth', loadChildren: () => import('./gen/auth/auth.module').then(m => m.AuthModule) },
      { path: 'label', loadChildren: () => import('./gen/label/label.module').then(m => m.LabelModule) },
      // { path: 'ac', loadChildren: () => import('./gen/ac/ac.module').then(m => m.AcModule) }
      { path: 'ac', loadChildren: () => import('./gen/ac/ac.module').then(m => m.AcModule) },
      { path: 'mock', loadChildren: () => import('./gen/mock/mock.module').then(m => m.MockModule) }
      // #endregion
    ]
  },

  { path: '404', component: NotFoundComponent },
  { path: '**', redirectTo: '404' }
];

@NgModule({
  imports: [SharedModule, RouterModule.forRoot(routes, environment.production ? {} : { useHash: true })],
  declarations: [...COMPONENTS]
})
export class RoutesModule { }
