import {Component, EventEmitter, Input, Output} from '@angular/core';

@Component({
  selector: 'cre-confirm-box',
  templateUrl: './confirm-box.component.html',
  styleUrls: ['./confirm-box.component.sass']
})
export class ConfirmBoxComponent {
  @Input() message: string

  @Output() cancel = new EventEmitter<void>()
  @Output() confirm = new EventEmitter<void>()

  visible = false

  emitCancel() {
    this.visible = false
    this.cancel.emit()
  }

  emitConfirm() {
    this.visible = false
    this.confirm.emit()
  }

  show() {
    this.visible = true
  }

  hide() {
    this.visible = false
  }
}
