import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { LoginlayoutComponent } from './Shared/loginlayout/loginlayout.component';
import { HomelayoutComponent } from './Shared/homelayout/homelayout.component';
import { LoginComponent } from './login/login.component';
import { LogoutComponent } from './logout/logout.component';
import { AuthGuard } from './auth.guard';
import { ChangepasswordComponent } from './changepassword/changepassword.component';
import { ResetpasswordComponent } from './resetpassword/resetpassword.component';
import { DownloaderComponent } from './home/downloader/downloader.component';
import { UploaderComponent } from './home/uploader/uploader.component';
const routes: Routes = [
  {
    path: '',
    component: LoginlayoutComponent,
    children: [
      { path: '', component: LoginComponent, pathMatch: 'full' },
      { path: 'login', component: LoginComponent, pathMatch: 'full' },
      { path: 'resetpassword', component: ResetpasswordComponent, pathMatch: 'full' }
    ]
  },
  {
    path: '',
    component: HomelayoutComponent,
    children: [
      { path: '', loadChildren: '../app/dashboard/dashboard.module#DashboardModule' },
      { path: 'dashboard', loadChildren: '../app/dashboard/dashboard.module#DashboardModule' },
      {
        path: 'masters',
        loadChildren: () => import('../app/masters/masters.module').then(m => m.MastersModule)
      },
      {
        path: 'usermanagement',
        loadChildren: '../app/usermanagement/usermanagement.module#UsermanagementModule'
      },
      {
        path: 'ccstageprocess',
        loadChildren: '../app/ccstageprocess/ccstageprocess.module#CcstageprocessModule'
        //loadChildren: () => import('../app/ccstageprocess/ccstageprocess.module').then(m => m.CcstageprocessModule)
      },
      {
        path: 'workflowconfiguration',
        loadChildren: '../app/workflowconfiguration/workflowconfiguration.module#WorkflowconfigurationModule'
      },
      {
        path: 'jobconfiguration',
        loadChildren: () => import('../app/jobconfiguration/jobconfiguration.module').then(m => m.JobconfigurationModule)
      },
      {
        path: 'projectconfiguration',
        loadChildren: () => import('../app/projectconfiguration/projectconfiguration.module').then(m => m.ProjectconfigurationModule)
      },
      {
        path: 'reports',
        loadChildren:()=> import('../app/reports/reports.module').then(m=>m.ReportsModule)
      },
      {
        path: 'chapterConfiguration',
        loadChildren: '../app/chapterconfiguration/chapterconfiguration.module#ChapterconfigurationModule'
      },
      { path: 'changepassword', component: ChangepasswordComponent, canActivate: [AuthGuard] }
    ]
  },
  { path: 'logout', component: LogoutComponent },
  { path: 'workarea', component: LogoutComponent },
  { path: 'downloader', component: DownloaderComponent },
  { path: 'uploader', component: UploaderComponent },
  
];


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