import { h } from "@stencil/core";
export class BpSdkStepperGroupButton {
    constructor() {
        this.answer = undefined;
        this.direction = undefined;
        this.buttonDisabled = false;
        this.handleStepperButtonClick = undefined;
        this.useExternal = false;
    }
    resetState() { }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-stepper-group-button');
        customElements.whenDefined('bp-sdk-external-stepper-group-button').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-stepper-group-button", { answer: this.answer, direction: this.direction, buttonDisabled: this.buttonDisabled, handleStepperButtonClick: this.handleStepperButtonClick }));
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-stepper-group-button__container" }, this.answer && (h("button", { type: "button", class: "bp-sdk-stepper-group-button__button", disabled: this.buttonDisabled, onClick: () => this.handleStepperButtonClick(this.answer, this.direction) }, this.answer.question.text))));
    }
    static get is() { return "bp-sdk-stepper-group-button"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-stepper-group-button.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-stepper-group-button.css"]
        };
    }
    static get properties() {
        return {
            "answer": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IAnswer | null",
                    "resolved": "IAnswer",
                    "references": {
                        "IAnswer": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswer"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Answer representing the previous or next step in stepper group"
                }
            },
            "direction": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'backward' | 'forward'",
                    "resolved": "\"backward\" | \"forward\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Direction that the button is pointing to in the stepper group"
                },
                "attribute": "direction",
                "reflect": false
            },
            "buttonDisabled": {
                "type": "boolean",
                "mutable": true,
                "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"
            },
            "handleStepperButtonClick": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(answer: IAnswer, direction: 'backward' | 'forward') => void",
                    "resolved": "(answer: IAnswer, direction: \"backward\" | \"forward\") => void",
                    "references": {
                        "IAnswer": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IAnswer"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Function that handles the navigation of steps.\nCall this function on button click."
                }
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
