import { h } from "@stencil/core";
import { generateId } from "@boldpenguin/sdk-utility";
export class BpSdkQuoteRequestButton {
    constructor() {
        this.text = '';
        this.buttonId = generateId(8);
        this.buttonDisabled = false;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-quote-request-button');
        customElements.whenDefined('bp-sdk-external-quote-request-button').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-quote-request-button", { buttonId: this.buttonId, buttonDisabled: this.buttonDisabled, text: this.text });
    }
    renderInternal() {
        return (h("bp-sdk-button", { class: "bp-sdk-quote-request-button__container", text: this.text, buttonId: this.buttonId, buttonDisabled: this.buttonDisabled }));
    }
    static get is() { return "bp-sdk-quote-request-button"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-quote-request-button.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-quote-request-button.css"]
        };
    }
    static get properties() {
        return {
            "text": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Text to be displayed"
                },
                "attribute": "text",
                "reflect": false,
                "defaultValue": "''"
            },
            "buttonId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Id for button"
                },
                "attribute": "button-id",
                "reflect": false,
                "defaultValue": "generateId(8)"
            },
            "buttonDisabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Controls disabled state of button"
                },
                "attribute": "button-disabled",
                "reflect": false,
                "defaultValue": "false"
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
