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


@Component({
  selector: 'app-message-box',
  templateUrl: './message-box.component.html',
  styleUrls: ['./message-box.component.scss']
})
export class MessageBoxComponent implements OnInit {
  @Input() YesButtonText = 'Ok I got it';
  @Input() NoButtonText = 'No';
  @Input() Title = 'Please Notice';
  @Input() Mode = 'YesOnly';

  @Output() onClose = new EventEmitter<string>();

  public opened = false; // dialog box
  public Message = '';   // dialog message

  constructor() { }

  ngOnInit(): void {
  }

  public close(status: string): void {
    this.onClose.emit(status);
    this.opened = false;
  }

  public Show(Msg: string, mode?: string, title?: string, yesText?: string, noText?: string): void{
    this.Message = Msg;
    this.Mode = mode || 'YesOnly';
    this.Title = title || 'Please notice';
    this.YesButtonText = yesText || 'Ok I got it';
    this.NoButtonText = noText || 'No';
    this.opened = true;
  }
}
