import { h, } from "@stencil/core";
import state from "../../../store";
export class ModalFlowRider {
  constructor() {
    this.formData = undefined;
    this.successIcon = "checkmark-circle";
    this.headerTitle = "flow";
    this.flowId = undefined;
    this.renderId = undefined;
    this.fetch = undefined;
    this.stepInput = {};
    this.endpoint = undefined;
    this.isLoading = true;
    this.locationId = undefined;
    this.materialId = undefined;
    this.successMessage = undefined;
    this.beforeSubmit = undefined;
    this.successTemplate = undefined;
    this.errorTemplate = undefined;
    this.showProgress = true;
    this.currentPath = undefined;
    this.currentStep = undefined;
    this.showCard = false;
  }
  toggleCard() {
    this.showCard = !this.showCard;
  }
  render() {
    var _a;
    const materialId = ((_a = this.formData) === null || _a === void 0 ? void 0 : _a.materialId) || null;
    return [
      h("ion-header", null, h("ion-toolbar", null, h("ion-title", null, this.headerTitle), h("ion-buttons", { slot: "end" }, h("ion-button", { title: "toggle the background", onClick: () => this.toggleCard() }, h("ion-icon", { slot: "icon-only", name: "browsers" })), h("ion-button", { onClick: () => this.floodteamCloseModal.emit() }, h("ion-icon", { slot: "icon-only", name: "close-circle-outline" }))))),
      h("ion-content", null, this.showCard ? (h("ion-card", null, h("floodteam-flow-rider", { formData: this.formData, renderId: this.renderId, fetch: this.fetch, stepInput: {
          dotConfirm: {
            materialId,
            material: state.materials ||
              [].find((material) => material.id === materialId),
          },
        }, endpoint: this.endpoint, isLoading: this.isLoading, successMessage: this.successMessage, beforeSubmit: this.beforeSubmit, successTemplate: this.successTemplate, errorTemplate: this.errorTemplate, showProgress: this.showProgress, currentPath: this.currentPath, currentStep: this.currentStep, flowId: this.flowId, templates: state === null || state === void 0 ? void 0 : state.templates, successIcon: this.successIcon, materialId: this.materialId }))) : (h("floodteam-flow-rider", { formData: this.formData, renderId: this.renderId, fetch: this.fetch, stepInput: {
          dotConfirm: {
            materialId,
            material: state.materials ||
              [].find((material) => material.id === materialId),
          },
        }, endpoint: this.endpoint, isLoading: this.isLoading, successMessage: this.successMessage, beforeSubmit: this.beforeSubmit, successTemplate: this.successTemplate, errorTemplate: this.errorTemplate, showProgress: this.showProgress, currentPath: this.currentPath, currentStep: this.currentStep, flowId: this.flowId, templates: state === null || state === void 0 ? void 0 : state.templates, successIcon: this.successIcon, materialId: this.materialId }))),
    ];
  }
  static get is() { return "modal-flow-rider"; }
  static get originalStyleUrls() {
    return {
      "$": ["modal-flow-rider.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["modal-flow-rider.css"]
    };
  }
  static get properties() {
    return {
      "formData": {
        "type": "any",
        "mutable": true,
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "form-data",
        "reflect": false
      },
      "successIcon": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "success-icon",
        "reflect": false,
        "defaultValue": "\"checkmark-circle\""
      },
      "headerTitle": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "header-title",
        "reflect": false,
        "defaultValue": "\"flow\""
      },
      "flowId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "flow-id",
        "reflect": false
      },
      "renderId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "render-id",
        "reflect": false
      },
      "fetch": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "fetch",
        "reflect": false
      },
      "stepInput": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "{ [stepName: string]: any }",
          "resolved": "{ [stepName: string]: any; }",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "defaultValue": "{}"
      },
      "endpoint": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "endpoint",
        "reflect": false
      },
      "isLoading": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "is-loading",
        "reflect": false,
        "defaultValue": "true"
      },
      "locationId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "location-id",
        "reflect": false
      },
      "materialId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "material-id",
        "reflect": false
      },
      "successMessage": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The success message to show beneath the icon"
        },
        "attribute": "success-message",
        "reflect": false
      },
      "beforeSubmit": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "(data: any) => Promise<any>",
          "resolved": "(data: any) => Promise<any>",
          "references": {
            "Promise": {
              "location": "global"
            }
          }
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": ""
        }
      },
      "successTemplate": {
        "type": "any",
        "mutable": false,
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The template to use for success at end of flow"
        },
        "attribute": "success-template",
        "reflect": false
      },
      "errorTemplate": {
        "type": "any",
        "mutable": false,
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The template to use for error"
        },
        "attribute": "error-template",
        "reflect": false
      },
      "showProgress": {
        "type": "boolean",
        "mutable": true,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Should we show a progress bar for the flow?"
        },
        "attribute": "show-progress",
        "reflect": false,
        "defaultValue": "true"
      },
      "currentPath": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The current path of the flow they are in"
        },
        "attribute": "current-path",
        "reflect": false
      },
      "currentStep": {
        "type": "string",
        "mutable": true,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The current step of the path they are on"
        },
        "attribute": "current-step",
        "reflect": false
      }
    };
  }
  static get states() {
    return {
      "showCard": {}
    };
  }
  static get events() {
    return [{
        "method": "floodteamCloseModal",
        "name": "floodteamCloseModal",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
}
