import { Component, Element, h, Prop, State } from "@stencil/core";
import * as translation from "./translation";
export class IntergiroCustomerLimit {
  componentWillLoad() {
    this.t = translation.create(this.element);
  }
  render() {
    const limit = typeof this.customer.limit == "number" ? this.customer.limit : undefined;
    const hard = typeof this.customer.limit == "object" && this.customer.limit.hard ? this.customer.limit.hard : undefined;
    const soft = typeof this.customer.limit == "object" && this.customer.limit.soft ? this.customer.limit.soft : undefined;
    const margin = typeof this.customer.limit == "object" && this.customer.limit.margin ? this.customer.limit.margin : undefined;
    return limit ? (h("section", null,
      h("label", null, this.t("Credit limit")),
      h("smoothly-display", null, limit + " " + this.customer.currency))) : ([
      hard && (h("section", null,
        h("label", null, this.t("Credit limit")),
        h("smoothly-display", null, hard + " " + this.customer.currency))),
      soft && (h("section", null,
        h("label", null, this.t("Soft limit")),
        h("smoothly-display", null, soft + " " + this.customer.currency),
        h("span", null, this.t("Automatic charge limit.")))),
      margin && (h("section", null,
        h("label", null, this.t("Margin")),
        h("smoothly-display", null, margin + " " + this.customer.currency),
        h("span", null, this.t("Automatic charge margin.")))),
    ]);
  }
  static get is() { return "ig-customer-limit"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "customer": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Customer",
        "resolved": "Customer",
        "references": {
          "Customer": {
            "location": "import",
            "path": "@payfunc/model"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
  static get states() { return {
    "t": {}
  }; }
  static get elementRef() { return "element"; }
}
