/*
 * Copyright (C) 2018 Robert Bosch GmbH Copyright (C) 2018 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Injectable, ViewContainerRef } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { ModalWindowService } from '../modal-window/modal-window.service';
import { AlertDialogComponent } from './alert-dialog/alert-dialog.component';
import { AlertBoxOptions } from './models/alert-box-options';

@Injectable({
  providedIn: 'root',
})
export class AlertService {
  constructor(private dialog: MatDialog, private modalWindowService: ModalWindowService) {}

  openAlertBox(options: AlertBoxOptions, alertBoxViewContainerReference?: ViewContainerRef): MatDialogRef<AlertDialogComponent> {
    return this.modalWindowService.openDialogWithComponent<AlertDialogComponent, AlertBoxOptions>(
      AlertDialogComponent,
      {
        disableClose: true,
        data: options,
        autoFocus: false,
        panelClass: 'alert-dialog',
        viewContainerRef: alertBoxViewContainerReference
      }
      );
    }
}
