import { Component, Event, h, Prop, State, Watch } from '@stencil/core';
import { StateOfReminder } from '../../utils/utils';
export class SynbeeOptionsMenu {
  constructor() {
    this.optionsInputUpdate = ['Modifica', 'Cancella'];
    this.optionInputCreate = ['Cancella'];
    this.menuIsOpen = false;
    this.menuOpened = false;
  }
  //ngOnChange()
  switchMenuIsOpen(newValue) {
    this.menuIsOpen = newValue;
  }
  componentShouldUpdate() {
    this.status = this.state;
  }
  onRowClicked(str) {
    if (str === 'Modifica') {
      this.menuOpened = false;
      this.changeStatusEmitter.emit('edit');
    }
    else {
      console.log('cancellato');
      this.changeStatusEmitter.emit('delete');
    }
  }
  render() {
    if (this.status === StateOfReminder.create) {
      return (h("div", { class: "options" },
        h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
          h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })),
        h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } },
          h("div", { class: "title-option" }, "Opzioni"),
          h("table", null, this.optionInputCreate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) },
            h("td", null, s))))))));
    }
    else if (this.status === StateOfReminder.view) {
      return (h("div", { class: "options" },
        h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
          h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })),
        h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } },
          h("div", { class: "title-option" }, "Opzioni"),
          h("table", { class: "table-view" }, this.optionsInputUpdate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) },
            h("td", null, s))))))));
    }
    else {
      return (h("div", { class: "options" },
        h("svg", { width: "4", height: "16", viewBox: "0 0 4 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
          h("path", { d: "M2 4C3.1 4 4 3.1 4 2C4 0.9 3.1 0 2 0C0.9 0 0 0.9 0 2C0 3.1 0.9 4 2 4ZM2 6C0.9 6 0 6.9 0 8C0 9.1 0.9 10 2 10C3.1 10 4 9.1 4 8C4 6.9 3.1 6 2 6ZM2 12C0.9 12 0 12.9 0 14C0 15.1 0.9 16 2 16C3.1 16 4 15.1 4 14C4 12.9 3.1 12 2 12Z", fill: "#8C8C8C" })),
        h("div", { class: { 'options-container': true, 'hidden': !this.menuIsOpen } },
          h("div", { class: "title-option" }, "Opzioni"),
          h("table", null, this.optionInputCreate.map(s => (h("tr", { class: "options-label", onClick: () => this.onRowClicked(s) },
            h("td", null, s))))))));
    }
  }
  static get is() { return "synbee-options-menu"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["synbee-options-menu.css"]
  }; }
  static get styleUrls() { return {
    "$": ["synbee-options-menu.css"]
  }; }
  static get properties() { return {
    "menuOpened": {
      "type": "boolean",
      "mutable": true,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "menu-opened",
      "reflect": false,
      "defaultValue": "false"
    },
    "state": {
      "type": "number",
      "mutable": false,
      "complexType": {
        "original": "StateOfReminder",
        "resolved": "StateOfReminder.create | StateOfReminder.edit | StateOfReminder.view",
        "references": {
          "StateOfReminder": {
            "location": "import",
            "path": "../../utils/utils"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "state",
      "reflect": false
    }
  }; }
  static get states() { return {
    "menuIsOpen": {},
    "status": {}
  }; }
  static get events() { return [{
      "method": "changeStatusEmitter",
      "name": "changeStatusEmitter",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      }
    }]; }
  static get watchers() { return [{
      "propName": "menuOpened",
      "methodName": "switchMenuIsOpen"
    }]; }
}
