import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { ConfirmDialog } from '@msfa-enums/confirm-dialog.enum';

@Component({
  selector: 'msfa-confirm-dialog',
  templateUrl: './confirm-dialog.component.html',
  styleUrls: ['./confirm-dialog.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ConfirmDialogComponent {
  @Input() openConfirmDialog: boolean;
  @Input() itemToConfirm: string;
  @Output() confirmDialogChanged = new EventEmitter<ConfirmDialog>();

  sendRequest(): void {
    this.openConfirmDialog = false;
    this.confirmDialogChanged.emit(ConfirmDialog.ACCEPTED);
  }

  closeConfirmDialog(): void {
    this.openConfirmDialog = false;
    this.confirmDialogChanged.emit(ConfirmDialog.DISMISSED);
  }

}
