import { Component, Element, h, Prop, State } from "@stencil/core";
import { Address, Addresses, CountryCode } from "../model";
import * as translation from "./translation";
export class IntergiroDisplayAddress {
  async componentWillLoad() {
    this.t = translation.create(this.element);
  }
  render() {
    const t = this.t;
    return Address.SE.is(this.data) || Address.FI.is(this.data) ? ([
      h("address", null,
        this.data.street,
        h("br", null),
        this.data.zipCode,
        " ",
        this.data.city,
        h("br", null),
        CountryCode.Name.from("en", this.data.countryCode),
        h("br", null)),
    ]) : Address.is(this.data) ? (h("p", null,
      t("Unknown address country"),
      ": ",
      JSON.stringify(this.data))) : Addresses.is(this.data) ? (Addresses.map(this.data, (type, address) => h("ig-display-address", { type: type, data: address }))) : ("");
  }
  static get is() { return "ig-display-address"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "type": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "type",
      "reflect": false
    },
    "data": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Address | Addresses",
        "resolved": "Addresses | DE | DK | FI | General | NO | SE",
        "references": {
          "Address": {
            "location": "import",
            "path": "../model"
          },
          "Addresses": {
            "location": "import",
            "path": "../model"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
  static get states() { return {
    "t": {}
  }; }
  static get elementRef() { return "element"; }
}
