import { h } from "@stencil/core";
export class BpSdkVehicleConfigurations {
    constructor() {
        this.answerId = undefined;
        this.code = undefined;
        this.label = undefined;
        this.pristine = true;
        this.touched = false;
        this.errors = [];
        this.configurations = [];
        this.selectedConfigurationId = undefined;
        this.answeredBySource = '';
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-vehicle-configurations');
        customElements.whenDefined('bp-sdk-external-vehicle-configurations').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-vehicle-configurations", { answerId: this.answerId, code: this.code, configurations: this.configurations, errors: this.errors, label: this.label, pristine: this.pristine, selectedConfigurationId: this.selectedConfigurationId, touched: this.touched }));
    }
    renderInternal() {
        return (h("bp-sdk-dynamic-input", { answerId: this.answerId, choiceId: this.selectedConfigurationId, choices: this.configurations, code: this.code, errors: this.errors, fieldType: 'dropdown', inputComponentType: 'dropdown', isAutocomplete: false, isLabelledField: true, label: this.label, pristine: this.pristine, touched: this.touched, answeredBySource: this.answeredBySource }));
    }
    static get is() { return "bp-sdk-vehicle-configurations"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-vehicle-configurations.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-vehicle-configurations.css"]
        };
    }
    static get properties() {
        return {
            "answerId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The id of the answer associated with this field"
                },
                "attribute": "answer-id",
                "reflect": false
            },
            "code": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The question code associated with this field"
                },
                "attribute": "code",
                "reflect": false
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Label to display"
                },
                "attribute": "label",
                "reflect": false
            },
            "pristine": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Is pristine"
                },
                "attribute": "pristine",
                "reflect": false,
                "defaultValue": "true"
            },
            "touched": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Is touched"
                },
                "attribute": "touched",
                "reflect": false,
                "defaultValue": "false"
            },
            "errors": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "string[]",
                    "resolved": "string[]",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Error messages"
                },
                "defaultValue": "[]"
            },
            "configurations": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IChoice[]",
                    "resolved": "IChoice[]",
                    "references": {
                        "IChoice": {
                            "location": "import",
                            "path": "@boldpenguin/sdk-types",
                            "id": "../sdk-types/dist/types.d.ts::IChoice"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Configurations choices"
                },
                "defaultValue": "[]"
            },
            "selectedConfigurationId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Selected configuration ID"
                },
                "attribute": "selected-configuration-id",
                "reflect": false
            },
            "answeredBySource": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The source a question was answered by, if not answered directly"
                },
                "attribute": "answered-by-source",
                "reflect": false,
                "defaultValue": "''"
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
