import { h, Host } from "@stencil/core";
import { CardBrandLabels } from "./payment-method-option-utils";
import { radioListItem } from "../../styles/parts";
export class JustifiSavedPaymentMethod {
    constructor() {
        this.onPaymentMethodOptionClick = (e) => {
            e.preventDefault();
            this.paymentMethodOptionSelected.emit(this.paymentMethodOption);
        };
    }
    async resolvePaymentMethod(insuranceValidation) {
        var _a;
        if (!insuranceValidation.isValid) {
            return { validationError: true };
        }
        return { token: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id };
    }
    ;
    render() {
        var _a, _b, _c;
        return (h(Host, { key: '66b8725a684241fc105d182ee5982167b2007506', class: "payment-method" }, h("div", { key: 'd0370f70b880f6a83b18eaeeefce7b8fde342ce9', class: "radio-list-item p-3", part: radioListItem, onClick: this.onPaymentMethodOptionClick }, h("form-control-radio", { key: '76ed425815f77082ba1145aa2df04beef6044e07', name: "paymentMethodType", value: (_a = this.paymentMethodOption) === null || _a === void 0 ? void 0 : _a.id, checked: this.isSelected, label: `${CardBrandLabels[(_b = this.paymentMethodOption) === null || _b === void 0 ? void 0 : _b.brand] || ''} *${(_c = this.paymentMethodOption) === null || _c === void 0 ? void 0 : _c.acct_last_four}` }))));
    }
    static get is() { return "justifi-saved-payment-method"; }
    static get properties() {
        return {
            "paymentMethodOption": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "PaymentMethodOption",
                    "resolved": "PaymentMethodOption",
                    "references": {
                        "PaymentMethodOption": {
                            "location": "import",
                            "path": "./payment-method-option-utils",
                            "id": "src/components/checkout/payment-method-option-utils.ts::PaymentMethodOption"
                        }
                    }
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false
            },
            "isSelected": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-selected"
            }
        };
    }
    static get events() {
        return [{
                "method": "paymentMethodOptionSelected",
                "name": "paymentMethodOptionSelected",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "resolvePaymentMethod": {
                "complexType": {
                    "signature": "(insuranceValidation: any) => Promise<PaymentMethodPayload>",
                    "parameters": [{
                            "name": "insuranceValidation",
                            "type": "any",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "PaymentMethodPayload": {
                            "location": "import",
                            "path": "./payment-method-payload",
                            "id": "src/components/checkout/payment-method-payload.ts::PaymentMethodPayload"
                        }
                    },
                    "return": "Promise<PaymentMethodPayload>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
}
