import { h, Host } from "@stencil/core";
import { PAYMENT_METHODS } from "../../modular-checkout/ModularCheckout";
export class BillingForm {
    get showSimpleCardBillingForm() {
        return this.paymentMethodType === PAYMENT_METHODS.NEW_CARD && this.hideCardBillingForm;
    }
    get showSimpleBankAccountBillingForm() {
        return this.paymentMethodType === PAYMENT_METHODS.NEW_BANK_ACCOUNT && this.hideBankAccountBillingForm;
    }
    async getValues() {
        var _a;
        return (_a = this.selectedFormRef) === null || _a === void 0 ? void 0 : _a.getValues();
    }
    async validate() {
        var _a;
        return (_a = this.selectedFormRef) === null || _a === void 0 ? void 0 : _a.validate();
    }
    render() {
        if (this.showSimpleBankAccountBillingForm) {
            return (h(Host, null, h("bank-account-billing-form-simple", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
        }
        if (this.showSimpleCardBillingForm) {
            return (h(Host, null, h("card-billing-form-simple", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
        }
        return (h(Host, null, h("billing-form-full", { legend: this.legend, ref: (el) => (this.selectedFormRef = el) })));
    }
    static get is() { return "billing-form"; }
    static get properties() {
        return {
            "legend": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "legend"
            },
            "hideCardBillingForm": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hide-card-billing-form"
            },
            "hideBankAccountBillingForm": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hide-bank-account-billing-form"
            },
            "paymentMethodType": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "payment-method-type"
            }
        };
    }
    static get methods() {
        return {
            "getValues": {
                "complexType": {
                    "signature": "() => Promise<BillingFormFields>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "BillingFormFields": {
                            "location": "import",
                            "path": "./billing-form-schema",
                            "id": "src/components/checkout/billing-form/billing-form-schema.ts::BillingFormFields"
                        }
                    },
                    "return": "Promise<BillingFormFields>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            },
            "validate": {
                "complexType": {
                    "signature": "() => Promise<{ isValid: boolean; errors: any; }>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<{ isValid: boolean; errors: any; }>"
                },
                "docs": {
                    "text": "",
                    "tags": []
                }
            }
        };
    }
}
