import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {
    CapitalizePipe,
    CircleButtonComponent,
    DetailsRadioComponent,
    DynamicInputComponent,
    EditableInputComponent,
    EmptyStateComponent,
    HasScrollbarDirective,
    IconButtonComponent,
    InputWithActionComponent,
    IqserAllowDirective,
    IqserDenyDirective,
    IqserHelpModeModule,
    IqserRoutes,
    IqserUploadFileModule,
    LogPipe,
    PreventDefaultDirective,
    RoundCheckboxComponent,
    StatusBarComponent,
    StopPropagationDirective,
    TenantPipe,
} from '@iqser/common-ui';
import { TranslateModule } from '@ngx-translate/core';
import { RouterModule } from '@angular/router';
import { FilePreviewScreenComponent } from './file-preview-screen.component';
import { FileWorkloadComponent } from './components/file-workload/file-workload.component';
import { AnnotationDetailsComponent } from './components/annotation-details/annotation-details.component';
import { AnnotationsListComponent } from './components/annotations-list/annotations-list.component';
import { PageIndicatorComponent } from './components/page-indicator/page-indicator.component';
import { PageExclusionComponent } from './components/page-exclusion/page-exclusion.component';
import { AnnotationActionsComponent } from './components/annotation-actions/annotation-actions.component';
import { CommentsComponent } from './components/comments/comments.component';
import { DocumentInfoComponent } from './components/document-info/document-info.component';
import { OverlayModule } from '@angular/cdk/overlay';
import { ViewSwitchComponent } from './components/view-switch/view-switch.component';
import { UserManagementComponent } from './components/user-management/user-management.component';
import { AnnotationReferencesListComponent } from './components/annotation-references-list/annotation-references-list.component';
import { AcceptRecommendationDialogComponent } from './dialogs/accept-recommendation-dialog/accept-recommendation-dialog.component';
import { AnnotationCardComponent } from './components/annotation-card/annotation-card.component';
import { AnnotationReferencesPageIndicatorComponent } from './components/annotation-references-page-indicator/annotation-references-page-indicator.component';
import { HighlightsSeparatorComponent } from './components/highlights-separator/highlights-separator.component';
import { PendingChangesGuard } from '@guards/can-deactivate.guard';
import { ManualAnnotationDialogComponent } from './dialogs/manual-redaction-dialog/manual-annotation-dialog.component';
import { ForceAnnotationDialogComponent } from './dialogs/force-redaction-dialog/force-annotation-dialog.component';
import { ResizeAnnotationDialogComponent } from './dialogs/resize-annotation-dialog/resize-annotation-dialog.component';
import { ChangeLegalBasisDialogComponent } from './dialogs/change-legal-basis-dialog/change-legal-basis-dialog.component';
import { RecategorizeImageDialogComponent } from './dialogs/recategorize-image-dialog/recategorize-image-dialog.component';
import { HighlightActionDialogComponent } from './dialogs/highlight-action-dialog/highlight-action-dialog.component';
import { FilePreviewDialogService } from './services/file-preview-dialog.service';
import { DocumentInfoDialogComponent } from './dialogs/document-info-dialog/document-info-dialog.component';
import { ManualRedactionService } from './services/manual-redaction.service';
import { AnnotationWrapperComponent } from './components/annotation-wrapper/annotation-wrapper.component';
import { AnnotationReferenceComponent } from './components/annotation-reference/annotation-reference.component';
import { ImportRedactionsDialogComponent } from './dialogs/import-redactions-dialog/import-redactions-dialog';
import { DocumentUnloadedGuard } from './services/document-unloaded.guard';
import { FilePreviewRightContainerComponent } from './components/right-container/file-preview-right-container.component';
import { RssDialogComponent } from './dialogs/rss-dialog/rss-dialog.component';
import { ReadonlyBannerComponent } from './components/readonly-banner/readonly-banner.component';
import { SuggestionsService } from './services/suggestions.service';
import { PagesComponent } from './components/pages/pages.component';
import { SharedModule } from '@shared/shared.module';
import { SharedDossiersModule } from '../shared-dossiers/shared-dossiers.module';
import { RedactTextDialogComponent } from './dialogs/redact-text-dialog/redact-text-dialog.component';
import { RemoveRedactionDialogComponent } from './dialogs/remove-redaction-dialog/remove-redaction-dialog.component';
import { IqserUsersModule } from '@iqser/common-ui/lib/users';
import { IqserFiltersModule } from '@iqser/common-ui/lib/filtering';

const routes: IqserRoutes = [
    {
        path: '',
        component: FilePreviewScreenComponent,
        pathMatch: 'full',
        canDeactivate: [PendingChangesGuard, DocumentUnloadedGuard],
    },
];

const dialogs = [
    ManualAnnotationDialogComponent,
    ForceAnnotationDialogComponent,
    ResizeAnnotationDialogComponent,
    ChangeLegalBasisDialogComponent,
    RecategorizeImageDialogComponent,
    HighlightActionDialogComponent,
    AcceptRecommendationDialogComponent,
    DocumentInfoDialogComponent,
    ImportRedactionsDialogComponent,
    RssDialogComponent,
    RedactTextDialogComponent,
    RemoveRedactionDialogComponent,
];

const components = [
    FileWorkloadComponent,
    AnnotationDetailsComponent,
    AnnotationWrapperComponent,
    AnnotationsListComponent,
    PageIndicatorComponent,
    PagesComponent,
    PageExclusionComponent,
    AnnotationActionsComponent,
    CommentsComponent,
    DocumentInfoComponent,
    ViewSwitchComponent,
    UserManagementComponent,
    AnnotationReferencesListComponent,
    AnnotationCardComponent,
    AnnotationReferencesPageIndicatorComponent,
    HighlightsSeparatorComponent,
    AnnotationReferenceComponent,
    FilePreviewScreenComponent,
    FilePreviewRightContainerComponent,
    ReadonlyBannerComponent,
];

@NgModule({
    declarations: [...components, ...dialogs],
    imports: [
        RouterModule.forChild(routes),
        CommonModule,
        TranslateModule,
        OverlayModule,
        IqserHelpModeModule,
        IqserUsersModule,
        CapitalizePipe,
        IqserUploadFileModule,
        IqserFiltersModule,
        SharedModule,
        CircleButtonComponent,
        SharedDossiersModule,
        IconButtonComponent,
        EmptyStateComponent,
        StatusBarComponent,
        StopPropagationDirective,
        PreventDefaultDirective,
        HasScrollbarDirective,
        EditableInputComponent,
        DetailsRadioComponent,
        DynamicInputComponent,
        InputWithActionComponent,
        RoundCheckboxComponent,
        IqserAllowDirective,
        IqserDenyDirective,
        TenantPipe,
        LogPipe,
    ],
    providers: [FilePreviewDialogService, ManualRedactionService, DocumentUnloadedGuard, SuggestionsService],
})
export class FilePreviewModule {}
