import { h, } from "@stencil/core";
import state from "../../../store";
export class AppPay {
  constructor() {
    this.jobId = undefined;
  }
  async fetchJob() {
    if (!this.jobId)
      return;
    this.fireenjinFetch.emit({
      endpoint: "findJob",
      params: {
        id: this.jobId,
        withPayments: true,
        withUsers: true,
        withSites: true,
        withPayModel: true,
        withPhotos: true,
        withEfiles: true,
        withPayables: false,
        withReadings: true,
      },
    });
  }
  componentDidLoad() {
    if (!(state === null || state === void 0 ? void 0 : state.job) && this.jobId)
      this.fetchJob();
  }
  render() {
    return [
      h("ion-content", { class: "ion-padding", style: { position: "relative" } }, h("floodteam-title-bar", { back: `/jobs/${this.jobId}`, icon: "logo-usd" }, h("ion-router-link", { href: "/payments" }, "Make a Payment")), h("ion-card", { style: {
          width: "90%",
          maxWidth: "800px",
          margin: "10% auto",
        } }, h("floodteam-payment-flow", { jobId: this.jobId }))),
      h("floodteam-navigation-footer", null),
    ];
  }
  static get is() { return "app-pay"; }
  static get originalStyleUrls() {
    return {
      "$": ["app-pay.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["app-pay.css"]
    };
  }
  static get properties() {
    return {
      "jobId": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": ""
        },
        "attribute": "job-id",
        "reflect": false
      }
    };
  }
  static get events() {
    return [{
        "method": "fireenjinFetch",
        "name": "fireenjinFetch",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "FireEnjinFetchEvent",
          "resolved": "FireEnjinFetchEvent",
          "references": {
            "FireEnjinFetchEvent": {
              "location": "import",
              "path": "@fireenjin/sdk"
            }
          }
        }
      }];
  }
}
