import { Component, OnInit } from '@angular/core';
import { UiModalRef } from '../defs/modal-ref';
import { DialogModel } from './dialog.model';

@Component({
  selector: 'ui-dialog-modal',
  templateUrl: './dialog-modal.component.html',
  styleUrls: ['./dialog-modal.component.scss'],
})
export class UiDialogModalComponent implements OnInit {
  constructor(public modalRef: UiModalRef<any, DialogModel>) {}

  ngOnInit() {}

  handleCommand(command: string) {
    if (command === 'CLOSE') {
      this.modalRef.close();
      return;
    }

    this.modalRef.close(command);
  }
}
