import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ForceAnnotationDialogComponent } from '../dialogs/force-redaction-dialog/force-annotation-dialog.component';
import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component';
import { ManualAnnotationDialogComponent } from '../dialogs/manual-redaction-dialog/manual-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 { ConfirmationDialogComponent, DialogConfig, DialogService } from '@iqser/common-ui';
import { ResizeAnnotationDialogComponent } from '../dialogs/resize-annotation-dialog/resize-annotation-dialog.component';
import { HighlightActionDialogComponent } from '../dialogs/highlight-action-dialog/highlight-action-dialog.component';
import { RssDialogComponent } from '../dialogs/rss-dialog/rss-dialog.component';

type DialogType =
    | 'confirm'
    | 'documentInfo'
    | 'rss'
    | 'recategorizeImage'
    | 'changeLegalBasis'
    | 'resizeAnnotation'
    | 'forceAnnotation'
    | 'manualAnnotation'
    | 'highlightAction';

@Injectable()
export class FilePreviewDialogService extends DialogService<DialogType> {
    protected readonly _config: DialogConfig<DialogType> = {
        confirm: {
            component: ConfirmationDialogComponent,
            dialogConfig: { disableClose: false },
        },
        documentInfo: {
            component: DocumentInfoDialogComponent,
            dialogConfig: { autoFocus: true },
        },
        recategorizeImage: {
            component: RecategorizeImageDialogComponent,
        },
        changeLegalBasis: {
            component: ChangeLegalBasisDialogComponent,
        },
        resizeAnnotation: {
            component: ResizeAnnotationDialogComponent,
        },
        forceAnnotation: {
            component: ForceAnnotationDialogComponent,
        },
        manualAnnotation: {
            component: ManualAnnotationDialogComponent,
            dialogConfig: { autoFocus: true },
        },
        highlightAction: {
            component: HighlightActionDialogComponent,
        },
        rss: {
            component: RssDialogComponent,
            dialogConfig: { width: '90vw' },
        },
    };

    constructor(protected readonly _dialog: MatDialog) {
        super(_dialog);
    }
}
