'use strict';

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

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

const appFlowListCss = "";

const AppFlowList = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.fireenjinTrigger = index.createEvent(this, "fireenjinTrigger", 7);
    this.fireenjinFetch = index.createEvent(this, "fireenjinFetch", 7);
    this.flows = undefined;
  }
  onSuccess(event) {
    var _a, _b, _c;
    if (((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.endpoint) === "listFlows") {
      this.flows = ((_c = (_b = event === null || event === void 0 ? void 0 : event.detail) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.flows) || [];
      console.log(this.flows, "flows");
    }
  }
  fetchFlow() {
    this.fireenjinFetch.emit({
      endpoint: "listFlows",
    });
  }
  componentDidLoad() {
    if (!(index.Build === null || index.Build === void 0 ? void 0 : index.Build.isBrowser))
      return;
    this.fetchFlow();
  }
  render() {
    return [
      index.h("ion-content", { class: "ion-padding" }, index.h("floodteam-title-bar", null, index.h("ion-router-link", { href: "/flows" }, "Flows")), index.h("div", { class: "ion-padding" }, (this.flows || []).map((flow) => (index.h("ion-item", { href: `/flows/${flow.id}`, detail: true, lines: "full" }, index.h("ion-grid", null, index.h("ion-row", { class: "ion-align-items-center ion-justify-content-between" }, index.h("ion-col", null, index.h("ion-label", null, index.h("h2", null, flow.name)))))))))),
      index.h("floodteam-navigation-footer", null, index.h("floodteam-title-bar", { back: "/dashboard" }, index.h("ion-breadcrumbs", null, index.h("ion-breadcrumb", { href: "/flows" }, index.h("ion-icon", { class: "ft-icon-style", slot: "start", name: "layers-outline" }), "Flows")), index.h("ion-buttons", { slot: "end" }, index.h("ion-button", { fill: "solid", color: "primary", href: "/flows/new" }, "Add")))),
    ];
  }
};
AppFlowList.style = appFlowListCss;

exports.app_flow_list = AppFlowList;
