import { r as registerInstance, d as createEvent, B as Build, h } from './index-33e43734.js';
import { g as getEventTypeOptions } from './getEventTypeOptions-359a8555.js';

const appTriggerListCss = "";

let AppTrigger = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.fireenjinSubmit = createEvent(this, "fireenjinSubmit", 7);
    this.eventIconMap = {
      alert: "notifications",
    };
    this.filters = [
      {
        name: "type",
        label: "Event Type",
        icon: "magnet",
        options: getEventTypeOptions(),
      },
    ];
  }
  onSearchInput(event) {
    this.query = event.target.value;
  }
  componentDidLoad() {
    if (!(Build === null || Build === void 0 ? void 0 : Build.isBrowser))
      return;
    // Get Data
  }
  render() {
    return [
      h("ion-content", { class: "ion-padding" }, h("floodteam-title-bar", null, h("ion-router-link", { href: "/triggers" }, "Triggers"), h("ion-buttons", { slot: "end" }, h("ion-button", { fill: "solid", color: "primary", href: "/triggers/new" }, "Add"))), h("div", { class: "ion-padding" }, h("fireenjin-search-bar", { ref: (el) => (this.filterBarEl = el), paginationEl: this.paginationEl, filters: this.filters }), h("fireenjin-pagination", { ref: (el) => (this.paginationEl = el), resultsKey: "triggers", disableVirtualScroll: true, removeDuplicates: true, listEl: ({ result: trigger }) => (h("ion-item", { href: `/triggers/${trigger.id}`, detail: true, lines: "full" }, h("ion-toggle", { slot: "start", name: "active", onClick: (event) => {
            event.preventDefault();
            event.stopPropagation();
          }, onIonChange: (event) => this.fireenjinSubmit.emit({
            endpoint: "editTrigger",
            id: trigger.id,
            data: {
              active: event.target.checked,
            },
          }), value: trigger === null || trigger === void 0 ? void 0 : trigger.id, checked: trigger === null || trigger === void 0 ? void 0 : trigger.active }), 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, trigger.name))), h("ion-col", null, (trigger === null || trigger === void 0 ? void 0 : trigger.type) && (h("ion-chip", { outline: true, style: {
            float: "right",
            opacity: "0.6",
          } }, h("ion-icon", { name: "magnet" }), h("ion-label", null, trigger === null || trigger === void 0 ? void 0 :
          trigger.type, " \u00A0 => \u00A0", " ", trigger === null || trigger === void 0 ? void 0 :
          trigger.action), h("ion-icon", { name: this.eventIconMap[trigger === null || trigger === void 0 ? void 0 : trigger.action] })))))))), display: "list", endpoint: "listTriggers", limit: 20, query: this.query }))),
      h("floodteam-navigation-footer", null),
    ];
  }
};
AppTrigger.style = appTriggerListCss;

export { AppTrigger as app_trigger_list };

//# sourceMappingURL=app-trigger-list.entry.js.map