import {NgModule} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {CatalogComponent} from "./pages/catalog/catalog.component";


const routes: Routes = [{
  path: 'color',
  loadChildren: () => import('./modules/colors/colors.module').then(m => m.ColorsModule)
}, {
  path: 'account',
  loadChildren: () => import('./modules/accounts/accounts.module').then(m => m.AccountsModule)
}, {
  path: 'employee',
  loadChildren: () => import('./modules/employees/employees.module').then(m => m.EmployeesModule)
}, {
  path: 'group',
  loadChildren: () => import('./modules/groups/groups.module').then(m => m.GroupsModule)
}, {
  path: 'catalog',
  component: CatalogComponent,
  children: [
    {
      path: 'materialtype',
      loadChildren: () => import('./modules/material-type/material-type.module').then(m => m.MaterialTypeModule),
    },
    {
      path: 'material',
      loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)
    },
    {
      path: 'company',
      loadChildren: () => import('./modules/company/company.module').then(m => m.CompanyModule)
    },
    {
      path: '',
      pathMatch: 'full',
      redirectTo: 'materialtype'
    }
  ]
},
  {path: 'material', loadChildren: () => import('./modules/material/material.module').then(m => m.MaterialModule)}];

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