import { BreadcrumbTypes, DOSSIER_ID, FILE_ID } from '@red/domain';
import { ArchivedDossiersScreenComponent } from './screens/archived-dossiers-screen/archived-dossiers-screen.component';
import { CompositeRouteGuard, IqserRoutes } from '@iqser/common-ui';
import { ARCHIVED_DOSSIERS_SERVICE } from '../../tokens';
import { DossierFilesGuard } from '@guards/dossier-files-guard';
import { ConfigService } from './services/config.service';
import { webViewerLoadedGuard } from '../pdf-viewer/services/webviewer-loaded.guard';

export default [
    {
        path: '',
        pathMatch: 'full',
        component: ArchivedDossiersScreenComponent,
        canActivate: [CompositeRouteGuard],
        data: {
            routeGuards: [DossierFilesGuard],
            breadcrumbs: [BreadcrumbTypes.dossierTemplate],
            reuse: true,
            dossiersService: ARCHIVED_DOSSIERS_SERVICE,
        },
        providers: [ConfigService],
    },
    {
        path: `:${DOSSIER_ID}`,
        canActivate: [CompositeRouteGuard],
        data: {
            routeGuards: [DossierFilesGuard],
            breadcrumbs: [BreadcrumbTypes.dossierTemplate, BreadcrumbTypes.dossier],
            dossiersService: ARCHIVED_DOSSIERS_SERVICE,
            skeleton: 'dossier',
        },
        loadChildren: () => import('../dossier-overview/dossier-overview.routes'),
    },
    {
        path: `:${DOSSIER_ID}/file/:${FILE_ID}`,
        canActivate: [CompositeRouteGuard, webViewerLoadedGuard()],
        data: {
            routeGuards: [DossierFilesGuard],
            breadcrumbs: [BreadcrumbTypes.dossierTemplate, BreadcrumbTypes.dossier, BreadcrumbTypes.file],
            dossiersService: ARCHIVED_DOSSIERS_SERVICE,
        },
        loadChildren: () => import('../file-preview/file-preview.routes'),
    },
] satisfies IqserRoutes;
