import { r as registerInstance, e as createEvent, B as Build, h } from './index-e0adbd54.js';

const appFlowListCss = "";

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

export { AppFlowList as app_flow_list };
