import { h } from "@stencil/core";
export class BpSdkQuoteRequestPremiumTerm {
    constructor() {
        this.price = undefined;
        this.showTotalPremium = undefined;
        this.termLength = undefined;
        this.totalPremium = undefined;
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-quote-request-premium-term');
        customElements.whenDefined('bp-sdk-external-quote-request-premium-term').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-quote-request-premium-term", { price: this.price, showTotalPremium: this.showTotalPremium, termLength: this.termLength, totalPremium: this.totalPremium }));
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-quote-request-premium-term__container" }, this.showTotalPremium && (h("div", { class: "bp-sdk-online-quote__price-total bp-sdk-quote__price-total" }, h("span", { class: "bp-sdk-online-quote__price-total-prefix bp-sdk-quote__price-total-prefix" }, "$"), h("span", { class: "bp-sdk-online-quote__price-total-number bp-sdk-quote__price-total-number" }, this.totalPremium), h("span", { class: "bp-sdk-online-quote__price-total-year bp-sdk-quote__price-total-suffix" }, "/year"))), !this.showTotalPremium && (h("p", { class: "bp-sdk-online-quote__price-main bp-sdk-quote__price-main" }, h("bp-sdk-quote-request-premium-payment", { price: this.price, period: this.termLength, showObelus: false })))));
    }
    static get is() { return "bp-sdk-quote-request-premium-term"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-quote-request-premium-term.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-quote-request-premium-term.css"]
        };
    }
    static get properties() {
        return {
            "price": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "term price"
                },
                "attribute": "price",
                "reflect": false
            },
            "showTotalPremium": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "should show total premium"
                },
                "attribute": "show-total-premium",
                "reflect": false
            },
            "termLength": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Term length"
                },
                "attribute": "term-length",
                "reflect": false
            },
            "totalPremium": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "total premium price if provided"
                },
                "attribute": "total-premium",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
