import { Component, Element, h, Listen, Prop, State } from "@stencil/core";
import { Item } from "@payfunc/model";
import * as translation from "./translation";
export class IntergiroOrderItems {
  constructor() {
    this.quantityStatus = false;
  }
  componentWillLoad() {
    this.t = translation.create(this.element);
  }
  handleQuantityStatus(event) {
    this.quantityStatus = true;
  }
  render() {
    const t = this.t;
    return [
      h("table", null,
        h("tr", null,
          h("th", null, this.quantityStatus ? t("Qty") : ""),
          h("th", { class: "wide" }, this.quantityStatus ? t("Name") : ""),
          h("th", null, this.quantityStatus ? t("Price") : ""),
          h("th", null, this.quantityStatus ? t("VAT") : ""),
          h("th", null, t("Total")),
          h("th", { class: "status" }, t("Status"))),
        typeof this.order.items === "number"
          ? []
          : Item.asArray(this.order.items).map((item, index) => (h("ig-order-items-quantity", { order: this.order.id, currency: this.order.currency, item: item }))),
        h("ig-order-items-total", { currency: this.order.currency, items: this.order.items })),
    ];
  }
  static get is() { return "ig-order-items"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "order": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Order",
        "resolved": "Order",
        "references": {
          "Order": {
            "location": "import",
            "path": "@payfunc/model"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
  static get states() { return {
    "t": {},
    "quantityStatus": {}
  }; }
  static get elementRef() { return "element"; }
  static get listeners() { return [{
      "name": "quantityStatus",
      "method": "handleQuantityStatus",
      "target": undefined,
      "capture": false,
      "passive": false
    }]; }
}
