import { Component, Element, h, Prop, State } from "@stencil/core";
import { Payment } from "@payfunc/model";
import * as translation from "./translation";
export class IntergirOrderPayment {
  componentWillLoad() {
    this.t = translation.create(this.element);
  }
  render() {
    const t = this.t;
    return (h("ul", null,
      h("li", null, this.order.payment.type == "card" ? (h("summary", null,
        h("dl", null,
          this.order.payment.type ? [h("dt", null, t("Type")), h("dd", null, t(this.order.payment.type))] : "",
          this.order.payment.scheme ? [h("dt", null, t("Scheme")), h("dd", null, this.order.payment.scheme)] : "",
          Payment.Card.is(this.order.payment)
            ? [
              h("dt", null, t("Number")),
              h("dd", null, this.order.payment.iin.substring(0, 4) +
                " " +
                this.order.payment.iin.substring(4) +
                "** **** " +
                this.order.payment.last4),
            ]
            : "",
          this.order.payment.expires
            ? [
              h("dt", null, t("Expires")),
              h("dd", null,
                this.order.payment.expires[0],
                "/",
                this.order.payment.expires[1]),
            ]
            : ""))) : this.order.payment.type == "defer" ? (h("summary", null,
        h("dl", null,
          this.order.payment.type ? [h("dt", null, t("Type")), h("dd", null, t(this.order.payment.type))] : "",
          this.order.payment.method ? [h("dt", null, t("Method")), h("dd", null, t(this.order.payment.method))] : "",
          this.order.payment.contact ? [h("dt", null, t("Contact")), h("dd", null, this.order.payment.contact)] : "",
          this.order.payment.message ? [h("dt", null, t("Message")), h("dd", null, this.order.payment.message)] : "",
          Payment.Defer.is(this.order.payment) && this.order.payment.link != undefined
            ? [
              h("dt", null),
              h("dd", { class: "icon" },
                h("a", { target: "_blank", href: this.order.payment.link },
                  h("smoothly-icon", { toolTip: t("Open link"), name: "open" }))),
            ]
            : ""))) : ("No payment information available."))));
  }
  static get is() { return "ig-order-payment"; }
  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": {}
  }; }
  static get elementRef() { return "element"; }
}
