import { Routes } from '@angular/router';
import { ReturnSearchMainComponent } from './return-search-main/return-search-main.component';
import { ReturnSearchComponent } from './return-search.component';
import { querySettingsResolverFn } from './resolvers/query-settings.resolver-fn';
import { ReturnSearchResultComponent } from './return-search-result/return-search-result.component';

export const routes: Routes = [
  {
    path: '',
    component: ReturnSearchComponent,
    resolve: { querySettings: querySettingsResolverFn },
    title: 'Retoure',
    children: [
      { path: '', component: ReturnSearchMainComponent },
      {
        path: 'receipts',
        component: ReturnSearchResultComponent,
        data: { scrollPositionRestoration: true },
      },
    ],
  },
  {
    path: 'receipt',
    title: 'Retoure - Beleg',
    loadChildren: () =>
      import('@isa/oms/feature/return-details').then((feat) => feat.routes),
  },
  {
    path: 'process',
    title: 'Retoure - Prozess',
    loadChildren: () =>
      import('@isa/oms/feature/return-process').then((feat) => feat.routes),
  },
];
