import { ApplicationContext } from '@sankhyalabs/core';
import { h } from '@stencil/core';
export class SnkActionsForm {
  constructor() {
    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 = ApplicationContext.getContextValue("__SNK__APPLICATION__");
  }
  render() {
    return (h("ez-popup", { size: "small", heightMode: "auto", useHeader: false, ref: (ref) => this._ezPopup = ref }, 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) }, h("div", { class: "ez-margin-bottom--large ez-flex ez-flex--column" }, h("label", { class: "ez-text ez-text--large ez-text--primary", innerHTML: this.message }), h("label", { class: "ez-text ez-text--large ez-text--primary" }, h("br", null), this._application.messagesBuilder.getMessage("snkActionsButton.clientEvent.cancelMessage", undefined))))));
  }
  static get is() { return "snk-client-confirm"; }
  static get encapsulation() { return "scoped"; }
  static get properties() {
    return {
      "titleMessage": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "T\u00EDtulo da popup."
        },
        "attribute": "title-message",
        "reflect": false
      },
      "message": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Mensagem da popup."
        },
        "attribute": "message",
        "reflect": false
      },
      "accept": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "() => void",
          "resolved": "() => void",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Retorno quando usu\u00E1rio confirmar."
        }
      },
      "cancel": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "() => void",
          "resolved": "() => void",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Retorno quando usu\u00E1rio cancelar."
        }
      }
    };
  }
  static get methods() {
    return {
      "openPopup": {
        "complexType": {
          "signature": "() => Promise<void>",
          "parameters": [],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "Respons\u00E1vel por abrir a popup.",
          "tags": []
        }
      }
    };
  }
}
