import { Component, Element, h, Prop, State } from "@stencil/core";
import { ModelState } from "../../../../model";
import * as translation from "../../details/history/translation";
export class IntergiroAuthorizationStatus {
  async componentWillLoad() {
    this.t = translation.create(this.element);
  }
  render() {
    const status = ModelState.Authorization.is(this.value)
      ? this.value.authorization.status.map(s => (s == "captured" ? "charged" : s))
      : [this.value.authorization.reason.replace(".", "").replace("_", " ")];
    return status.map((status) => (h("ig-status", { status: this.t(status != "" ? status : "unknown error"), color: !ModelState.Authorization.is(this.value) ? "danger" : undefined })));
  }
  static get is() { return "ig-authorization-status"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "value": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "ModelState.Authorization | ModelState.FailedAuthorization",
        "resolved": "Authorization | FailedAuthorization",
        "references": {
          "ModelState": {
            "location": "import",
            "path": "../../../../model"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    }
  }; }
  static get states() { return {
    "t": {}
  }; }
  static get elementRef() { return "element"; }
}
