'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-17105557.js');
const core = require('@sankhyalabs/core');

const SnkActionsForm = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.APLICAR = 'OK';
    this.CANCELAR = 'CANCEL';
    this.FECHAR = 'CLOSE';
    this.titleMessage = undefined;
    this.message = undefined;
    this.accept = undefined;
    this.cancel = undefined;
  }
  /**
   * Responsável por abrir a popup.
   */
  async openPopup() {
    this._ezPopup.opened = true;
  }
  ;
  exitPopup() {
    this._ezPopup.opened = false;
  }
  handleModalAction(evt) {
    switch (evt) {
      case this.APLICAR:
        this.exitPopup();
        this.accept();
        break;
      case this.CANCELAR:
        this.exitPopup();
        this.cancel();
        break;
      case this.FECHAR:
        this.exitPopup();
        break;
    }
  }
  componentWillLoad() {
    this._application = core.ApplicationContext.getContextValue("__SNK__APPLICATION__");
  }
  render() {
    return (index.h("ez-popup", { size: "small", heightMode: "auto", useHeader: false, ref: (ref) => this._ezPopup = ref }, index.h("ez-modal-container", { modalTitle: this.titleMessage, okButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.yes", undefined), cancelButtonLabel: this._application.messagesBuilder.getMessage("snkActionsButton.buttons.no", undefined), onEzModalAction: (evt) => this.handleModalAction(evt.detail) }, index.h("div", { class: "ez-margin-bottom--large ez-flex ez-flex--column" }, index.h("label", { class: "ez-text ez-text--large ez-text--primary", innerHTML: this.message }), index.h("label", { class: "ez-text ez-text--large ez-text--primary" }, index.h("br", null), this._application.messagesBuilder.getMessage("snkActionsButton.clientEvent.cancelMessage", undefined))))));
  }
};

exports.snk_client_confirm = SnkActionsForm;
