import { NgModule } from '@angular/core';
import { RouterModule, Routes, PreloadAllModules } from '@angular/router';
import { LogInComponent } from './components/log-in/log-in.component';
import { DashboardComponent } from './modules/dashboard/pages/dashboard.component';

const routes: Routes = [
  {
    path: 'login',
    children: [
      { path: '', component: LogInComponent, pathMatch: 'full' },
      { path: ':token', component: LogInComponent },
    ],
  },
  { path: 'dashboard', component: DashboardComponent },
  {
    path: 'product',
    loadChildren: () => import('./modules/product/product.module').then((m) => m.ProductModule),
  },
  {
    path: 'customer',
    loadChildren: () => import('./modules/customer/customer.module').then((m) => m.CustomerModule),
  },
  {
    path: 'branch',
    loadChildren: () => import('./modules/branch/branch.module').then((m) => m.BranchModule),
  },
  { path: 'shelf', loadChildren: () => import('./modules/shelf/shelf.module').then((m) => m.ShelfModule) },
  { path: 'cart', loadChildren: () => import('./modules/cart/cart.module').then((m) => m.CartModule) },
  { path: 'debug', loadChildren: () => import('./modules/debug/debug.module').then((m) => m.DebugModule) },
  { path: 'goodsin', loadChildren: () => import('./modules/goods-in/goods-in.module').then((m) => m.GoodsInModule) },
  { path: 'remission', loadChildren: () => import('./modules/remission/remission-client.module').then((m) => m.RemissionClientModule) },
  // { path: 'task-calendar', loadChildren: './modules/task-calendar/task-calendar.module#TaskCalendarModule'}
];

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