import { Component, Element, Event, h, Prop, State } from "@stencil/core";
import "smoothly";
import * as translation from "./translation";
export class IntergiroPaymentMethod {
  constructor() {
    this.deletable = false;
    this.selected = false;
  }
  componentWillLoad() {
    this.t = translation.create(this.element);
  }
  methodDeletedHandler(method) {
    this.deleteMethod.emit(method);
  }
  render() {
    return (h("div", { class: this.mode },
      h("ig-scheme-logotype", { size: this.mode == "card" ? "large" : "small", scheme: this.method.scheme }),
      h("smoothly-display", { type: "card-number", value: this.method.iin + "******" + this.method.last4 }),
      h("p", null, "Expires"),
      h("smoothly-display", { type: "card-expires", value: this.method.expires }),
      this.deletable
        ? [
          h("smoothly-icon", { name: "trash-outline", toolTip: this.t("Delete"), style: { display: this.selected ? "none" : "" }, size: this.mode == "card" ? "medium" : "small", onClick: () => (this.selected = true) }),
          h("smoothly-icon", { name: "trash", toolTip: this.t("Confirm removal"), style: { display: this.selected ? "block" : "none" }, color: "danger", size: this.mode == "card" ? "medium" : "small", onClick: () => this.methodDeletedHandler(this.method) }),
        ]
        : null));
  }
  static get is() { return "ig-payment-method"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "method": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Customer.Method",
        "resolved": "Card",
        "references": {
          "Customer": {
            "location": "import",
            "path": "@payfunc/model"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "mode": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "\"table\" | \"card\"",
        "resolved": "\"card\" | \"table\"",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "mode",
      "reflect": true
    },
    "deletable": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "deletable",
      "reflect": false,
      "defaultValue": "false"
    }
  }; }
  static get states() { return {
    "t": {},
    "selected": {}
  }; }
  static get events() { return [{
      "method": "deleteMethod",
      "name": "deleteMethod",
      "bubbles": true,
      "cancelable": true,
      "composed": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "complexType": {
        "original": "Customer.Method",
        "resolved": "Card",
        "references": {
          "Customer": {
            "location": "import",
            "path": "@payfunc/model"
          }
        }
      }
    }]; }
  static get elementRef() { return "element"; }
}
