import { Component, h, Listen, Prop, State, Watch } from "@stencil/core";
import { ModelState } from "../model";
export class IntergiroAuthorizations {
  componentWillLoad() {
    if (!this.authorizationsFiltered)
      this.authorizationsUpdate();
  }
  authorizationsUpdate() {
    var _a;
    this.authorizationsFiltered = (_a = this.authorizations) === null || _a === void 0 ? void 0 : _a.sort((a, b) => a.authorization.created < b.authorization.created ? 1 : -1);
  }
  handleFilterChanged(event) {
    this.authorizationsFiltered = event.detail;
    event.stopPropagation();
  }
  handleSelectedChanged(event) {
    this.authorizationsSelected = Object.values(event.detail).filter(ModelState.Authorization.is);
  }
  render() {
    var _a;
    return [
      this.authorizations && (h("ig-filter", { template: ModelState.Authorization.template, value: this.authorizations })),
      h("ig-authorization-table", { abbreviated: ((_a = this.merchants) === null || _a === void 0 ? void 0 : _a.length) == 1, authorizations: this.authorizationsFiltered, merchants: this.merchants, "cost-plus": this.costPlus }),
      h("ig-authorization-footer", { authorizations: this.authorizationsFiltered, authorizationsSelected: this.authorizationsSelected, conversion: this.conversion }),
    ];
  }
  static get is() { return "ig-authorizations"; }
  static get encapsulation() { return "scoped"; }
  static get originalStyleUrls() { return {
    "$": ["style.css"]
  }; }
  static get styleUrls() { return {
    "$": ["style.css"]
  }; }
  static get properties() { return {
    "authorizations": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "(ModelState.Authorization | ModelState.FailedAuthorization)[]",
        "resolved": "(Authorization | FailedAuthorization)[] | undefined",
        "references": {
          "ModelState": {
            "location": "import",
            "path": "../model"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "merchants": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Merchant[]",
        "resolved": "Merchant[]",
        "references": {
          "Merchant": {
            "location": "import",
            "path": "@payfunc/model-acquirer"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "conversion": {
      "type": "unknown",
      "mutable": false,
      "complexType": {
        "original": "Record<Currency, Partial<Record<Currency, number>>>",
        "resolved": "undefined | { AED: Partial<Record<Currency, number>>; AFN: Partial<Record<Currency, number>>; ALL: Partial<Record<Currency, number>>; AMD: Partial<Record<Currency, number>>; ANG: Partial<Record<Currency, number>>; AOA: Partial<Record<Currency, number>>; ARS: Partial<Record<Currency, number>>; AUD: Partial<Record<Currency, number>>; AWG: Partial<Record<Currency, number>>; AZN: Partial<Record<Currency, number>>; BAM: Partial<Record<Currency, number>>; BBD: Partial<Record<Currency, number>>; BDT: Partial<Record<Currency, number>>; BGN: Partial<Record<Currency, number>>; BHD: Partial<Record<Currency, number>>; BIF: Partial<Record<Currency, number>>; BMD: Partial<Record<Currency, number>>; BND: Partial<Record<Currency, number>>; BOB: Partial<Record<Currency, number>>; BOV: Partial<Record<Currency, number>>; BRL: Partial<Record<Currency, number>>; BSD: Partial<Record<Currency, number>>; BTN: Partial<Record<Currency, number>>; BWP: Partial<Record<Currency, number>>; BYN: Partial<Record<Currency, number>>; BZD: Partial<Record<Currency, number>>; CAD: Partial<Record<Currency, number>>; CDF: Partial<Record<Currency, number>>; CHE: Partial<Record<Currency, number>>; CHF: Partial<Record<Currency, number>>; CHW: Partial<Record<Currency, number>>; CLF: Partial<Record<Currency, number>>; CLP: Partial<Record<Currency, number>>; CNY: Partial<Record<Currency, number>>; COP: Partial<Record<Currency, number>>; COU: Partial<Record<Currency, number>>; CRC: Partial<Record<Currency, number>>; CUC: Partial<Record<Currency, number>>; CUP: Partial<Record<Currency, number>>; CVE: Partial<Record<Currency, number>>; CZK: Partial<Record<Currency, number>>; DJF: Partial<Record<Currency, number>>; DKK: Partial<Record<Currency, number>>; DOP: Partial<Record<Currency, number>>; DZD: Partial<Record<Currency, number>>; EGP: Partial<Record<Currency, number>>; ERN: Partial<Record<Currency, number>>; ETB: Partial<Record<Currency, number>>; EUR: Partial<Record<Currency, number>>; FJD: Partial<Record<Currency, number>>; FKP: Partial<Record<Currency, number>>; GBP: Partial<Record<Currency, number>>; GEL: Partial<Record<Currency, number>>; GHS: Partial<Record<Currency, number>>; GIP: Partial<Record<Currency, number>>; GMD: Partial<Record<Currency, number>>; GNF: Partial<Record<Currency, number>>; GTQ: Partial<Record<Currency, number>>; GYD: Partial<Record<Currency, number>>; HKD: Partial<Record<Currency, number>>; HNL: Partial<Record<Currency, number>>; HRK: Partial<Record<Currency, number>>; HTG: Partial<Record<Currency, number>>; HUF: Partial<Record<Currency, number>>; IDR: Partial<Record<Currency, number>>; ILS: Partial<Record<Currency, number>>; INR: Partial<Record<Currency, number>>; IQD: Partial<Record<Currency, number>>; IRR: Partial<Record<Currency, number>>; ISK: Partial<Record<Currency, number>>; JMD: Partial<Record<Currency, number>>; JOD: Partial<Record<Currency, number>>; JPY: Partial<Record<Currency, number>>; KES: Partial<Record<Currency, number>>; KGS: Partial<Record<Currency, number>>; KHR: Partial<Record<Currency, number>>; KMF: Partial<Record<Currency, number>>; KPW: Partial<Record<Currency, number>>; KRW: Partial<Record<Currency, number>>; KWD: Partial<Record<Currency, number>>; KYD: Partial<Record<Currency, number>>; KZT: Partial<Record<Currency, number>>; LAK: Partial<Record<Currency, number>>; LBP: Partial<Record<Currency, number>>; LKR: Partial<Record<Currency, number>>; LRD: Partial<Record<Currency, number>>; LSL: Partial<Record<Currency, number>>; LYD: Partial<Record<Currency, number>>; MAD: Partial<Record<Currency, number>>; MDL: Partial<Record<Currency, number>>; MGA: Partial<Record<Currency, number>>; MKD: Partial<Record<Currency, number>>; MMK: Partial<Record<Currency, number>>; MNT: Partial<Record<Currency, number>>; MOP: Partial<Record<Currency, number>>; MRU: Partial<Record<Currency, number>>; MUR: Partial<Record<Currency, number>>; MVR: Partial<Record<Currency, number>>; MWK: Partial<Record<Currency, number>>; MXN: Partial<Record<Currency, number>>; MXV: Partial<Record<Currency, number>>; MYR: Partial<Record<Currency, number>>; MZN: Partial<Record<Currency, number>>; NAD: Partial<Record<Currency, number>>; NGN: Partial<Record<Currency, number>>; NIO: Partial<Record<Currency, number>>; NOK: Partial<Record<Currency, number>>; NPR: Partial<Record<Currency, number>>; NZD: Partial<Record<Currency, number>>; OMR: Partial<Record<Currency, number>>; PAB: Partial<Record<Currency, number>>; PEN: Partial<Record<Currency, number>>; PGK: Partial<Record<Currency, number>>; PHP: Partial<Record<Currency, number>>; PKR: Partial<Record<Currency, number>>; PLN: Partial<Record<Currency, number>>; PYG: Partial<Record<Currency, number>>; QAR: Partial<Record<Currency, number>>; RON: Partial<Record<Currency, number>>; RSD: Partial<Record<Currency, number>>; RUB: Partial<Record<Currency, number>>; RWF: Partial<Record<Currency, number>>; SAR: Partial<Record<Currency, number>>; SBD: Partial<Record<Currency, number>>; SCR: Partial<Record<Currency, number>>; SDG: Partial<Record<Currency, number>>; SEK: Partial<Record<Currency, number>>; SGD: Partial<Record<Currency, number>>; SHP: Partial<Record<Currency, number>>; SLL: Partial<Record<Currency, number>>; SOS: Partial<Record<Currency, number>>; SRD: Partial<Record<Currency, number>>; SSP: Partial<Record<Currency, number>>; STN: Partial<Record<Currency, number>>; SVC: Partial<Record<Currency, number>>; SYP: Partial<Record<Currency, number>>; SZL: Partial<Record<Currency, number>>; THB: Partial<Record<Currency, number>>; TJS: Partial<Record<Currency, number>>; TMT: Partial<Record<Currency, number>>; TND: Partial<Record<Currency, number>>; TOP: Partial<Record<Currency, number>>; TRY: Partial<Record<Currency, number>>; TTD: Partial<Record<Currency, number>>; TWD: Partial<Record<Currency, number>>; TZS: Partial<Record<Currency, number>>; UAH: Partial<Record<Currency, number>>; UGX: Partial<Record<Currency, number>>; USD: Partial<Record<Currency, number>>; USN: Partial<Record<Currency, number>>; UYI: Partial<Record<Currency, number>>; UYU: Partial<Record<Currency, number>>; UYW: Partial<Record<Currency, number>>; UZS: Partial<Record<Currency, number>>; VES: Partial<Record<Currency, number>>; VND: Partial<Record<Currency, number>>; VUV: Partial<Record<Currency, number>>; WST: Partial<Record<Currency, number>>; XAF: Partial<Record<Currency, number>>; XAG: Partial<Record<Currency, number>>; XAU: Partial<Record<Currency, number>>; XBA: Partial<Record<Currency, number>>; XBB: Partial<Record<Currency, number>>; XBC: Partial<Record<Currency, number>>; XBD: Partial<Record<Currency, number>>; XCD: Partial<Record<Currency, number>>; XDR: Partial<Record<Currency, number>>; XOF: Partial<Record<Currency, number>>; XPD: Partial<Record<Currency, number>>; XPF: Partial<Record<Currency, number>>; XPT: Partial<Record<Currency, number>>; XSU: Partial<Record<Currency, number>>; XTS: Partial<Record<Currency, number>>; XUA: Partial<Record<Currency, number>>; XXX: Partial<Record<Currency, number>>; YER: Partial<Record<Currency, number>>; ZAR: Partial<Record<Currency, number>>; ZMW: Partial<Record<Currency, number>>; ZWL: Partial<Record<Currency, number>>; }",
        "references": {
          "Record": {
            "location": "global"
          },
          "Currency": {
            "location": "import",
            "path": "isoly"
          },
          "Partial": {
            "location": "global"
          }
        }
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      }
    },
    "costPlus": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean | undefined",
        "references": {}
      },
      "required": false,
      "optional": true,
      "docs": {
        "tags": [],
        "text": ""
      },
      "attribute": "cost-plus",
      "reflect": false
    }
  }; }
  static get states() { return {
    "authorizationsFiltered": {},
    "authorizationsSelected": {}
  }; }
  static get watchers() { return [{
      "propName": "authorizations",
      "methodName": "authorizationsUpdate"
    }]; }
  static get listeners() { return [{
      "name": "filterChanged",
      "method": "handleFilterChanged",
      "target": undefined,
      "capture": false,
      "passive": false
    }, {
      "name": "selectedChanged",
      "method": "handleSelectedChanged",
      "target": undefined,
      "capture": false,
      "passive": false
    }]; }
}
