import { h, } from "@stencil/core";
export class ModalFlowTest {
  constructor() {
    this.tests = undefined;
    this.test = undefined;
    this.flowId = undefined;
  }
  closeModal() {
    this.floodteamCloseModal.emit();
  }
  run(event, test) {
    console.log(test);
    event.preventDefault();
    return;
  }
  edit(_event, test) {
    console.log(test);
    this.test = test;
    return;
  }
  render() {
    var _a, _b, _c, _d, _e, _f;
    return [
      h("ion-header", null, h("ion-toolbar", null, h("ion-title", null, "Add / Edit Tests"), h("ion-buttons", { slot: "end" }, h("ion-button", { onClick: () => this.closeModal() }, h("ion-icon", { slot: "icon-only", name: "close-circle-outline" }))))),
      h("ion-content", null, h("ion-list", null, (_b = (_a = this.tests) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, test => h("ion-item", null, h("ion-buttons", { slot: "start" }, h("ion-button", { onClick: (event) => this.edit(event, test) }, h("ion-icon", { name: "create", slot: "icon-only" }))), h("ion-label", null, (test === null || test === void 0 ? void 0 : test.name) || "No Name"), h("ion-buttons", { slot: "end" }, h("ion-button", { onClick: (event) => this.run(event, test) }, h("ion-icon", { name: "play", slot: "icon-only" })))))), h("ion-card", null, h("fireenjin-form", { beforeSubmit: async (data) => ({ ...data, flowId: this.flowId }), endpoint: ((_c = this.test) === null || _c === void 0 ? void 0 : _c.id) ? "editTest" : "addTest", documentId: (_d = this.test) === null || _d === void 0 ? void 0 : _d.id }, h("fireenjin-input", { name: "name", label: "Name", labelPosition: "stacked", required: true, value: (_e = this.test) === null || _e === void 0 ? void 0 : _e.name }), h("fireenjin-code-editor", { name: "formData", label: "Form Data", labelPosition: "stacked", required: true, value: (_f = this.test) === null || _f === void 0 ? void 0 : _f.formData, outputObject: true })))),
    ];
  }
  static get is() { return "floodteam-modal-flow-test"; }
  static get originalStyleUrls() {
    return {
      "$": ["modal-flow-test.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["modal-flow-test.css"]
    };
  }
  static get properties() {
    return {
      "tests": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "FlowTest[]",
          "resolved": "FlowTest[]",
          "references": {
            "FlowTest": {
              "location": "import",
              "path": "../../../interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        }
      },
      "test": {
        "type": "unknown",
        "mutable": true,
        "complexType": {
          "original": "FlowTest",
          "resolved": "FlowTest",
          "references": {
            "FlowTest": {
              "location": "import",
              "path": "../../../interfaces"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        }
      },
      "flowId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "flow-id",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "floodteamCloseModal",
        "name": "floodteamCloseModal",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
  static get listeners() {
    return [{
        "name": "fireenjinReset",
        "method": "closeModal",
        "target": undefined,
        "capture": false,
        "passive": false
      }];
  }
}
