'use strict';

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

const index = require('./index-ee190ee0.js');

const modalFlowTestCss = "";

const ModalFlowTest = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.floodteamCloseModal = index.createEvent(this, "floodteamCloseModal", 7);
    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 [
      index.h("ion-header", null, index.h("ion-toolbar", null, index.h("ion-title", null, "Add / Edit Tests"), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { onClick: () => this.closeModal() }, index.h("ion-icon", { slot: "icon-only", name: "close-circle-outline" }))))),
      index.h("ion-content", null, index.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 => index.h("ion-item", null, index.h("ion-buttons", { slot: "start" }, index.h("ion-button", { onClick: (event) => this.edit(event, test) }, index.h("ion-icon", { name: "create", slot: "icon-only" }))), index.h("ion-label", null, (test === null || test === void 0 ? void 0 : test.name) || "No Name"), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { onClick: (event) => this.run(event, test) }, index.h("ion-icon", { name: "play", slot: "icon-only" })))))), index.h("ion-card", null, index.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 }, index.h("fireenjin-input", { name: "name", label: "Name", labelPosition: "stacked", required: true, value: (_e = this.test) === null || _e === void 0 ? void 0 : _e.name }), index.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 })))),
    ];
  }
};
ModalFlowTest.style = modalFlowTestCss;

exports.floodteam_modal_flow_test = ModalFlowTest;
