import { h } from "@stencil/core";
export class BpSdkAddItemContainer {
    constructor() {
        this.handleClick = () => {
            this.addItem.emit();
        };
        this.answerPoolId = undefined;
        this.helpText = '';
        this.text = '+';
        this.canAddMore = true;
        this.icon = undefined;
        this.questionId = undefined;
        this.questionSetId = undefined;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-add-item-container');
        customElements.whenDefined('bp-sdk-external-add-item-container').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return [
            h("slot", null),
            h("bp-sdk-external-add-item-container", { answerPoolId: this.answerPoolId, helpText: this.helpText, text: this.text, canAddMore: this.canAddMore, icon: this.icon, questionId: this.questionId, questionSetId: this.questionSetId }),
        ];
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-add-item__container" }, h("slot", null), this.canAddMore && (h("div", { class: "bp-sdk-add-item__wrapper" }, h("bp-sdk-icon-container", { name: this.icon }), this.helpText && h("h4", { class: "bp-sdk-add-item__help-text" }, this.helpText), h("bp-sdk-button", { onClick: this.handleClick, text: this.text })))));
    }
    static get is() { return "bp-sdk-add-item-container"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-add-item-container.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-add-item-container.css"]
        };
    }
    static get properties() {
        return {
            "answerPoolId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Id of the answer pool that this component belongs to"
                },
                "attribute": "answer-pool-id",
                "reflect": false
            },
            "helpText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Help text"
                },
                "attribute": "help-text",
                "reflect": false,
                "defaultValue": "''"
            },
            "text": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Add button text"
                },
                "attribute": "text",
                "reflect": false,
                "defaultValue": "'+'"
            },
            "canAddMore": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Can add more state"
                },
                "attribute": "can-add-more",
                "reflect": false,
                "defaultValue": "true"
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon name"
                },
                "attribute": "icon",
                "reflect": false
            },
            "questionId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Question Id"
                },
                "attribute": "question-id",
                "reflect": false
            },
            "questionSetId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Question Set Id"
                },
                "attribute": "question-set-id",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
    static get events() {
        return [{
                "method": "addItem",
                "name": "addItem",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Add Item event"
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
}
