import { h } from "@stencil/core";
import { generateId } from "@boldpenguin/sdk-utility";
export class BpSdkDriverQuestionSetButton {
    constructor() {
        this.text = '';
        this.buttonId = generateId(8);
        this.buttonDisabled = false;
        this.extraCssClasses = undefined;
        this.useExternal = false;
        this.cssClasses = 'bp-sdk-driver-question-set-button__container';
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-driver-question-set-button');
        customElements.whenDefined('bp-sdk-external-driver-question-set-button').then(() => {
            this.useExternal = true;
        });
        this.calculateButtonClasses(this.extraCssClasses);
    }
    calculateButtonClasses(extraClasses = '') {
        this.cssClasses = `bp-sdk-driver-question-set-button__container ${extraClasses}`;
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-driver-question-set-button", { class: this.extraCssClasses, text: this.text, buttonId: this.buttonId, buttonDisabled: this.buttonDisabled });
    }
    renderInternal() {
        return h("bp-sdk-button", { class: this.cssClasses, text: this.text, buttonId: this.buttonId, buttonDisabled: this.buttonDisabled });
    }
    static get is() { return "bp-sdk-driver-question-set-button"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-driver-question-set-button.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-driver-question-set-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"
            },
            "extraCssClasses": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Extra CSS classes to be added onto the question set button"
                },
                "attribute": "extra-css-classes",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {},
            "cssClasses": {}
        };
    }
    static get watchers() {
        return [{
                "propName": "extraCssClasses",
                "methodName": "calculateButtonClasses"
            }];
    }
}
