import { h } from "@stencil/core";
export class BpSdkVehiclePanelButtons {
    constructor() {
        this.canDelete = false;
        this.canEdit = false;
        this.handleDelete = undefined;
        this.handleEdit = undefined;
        this.useExternal = false;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-vehicle-panel-buttons');
        customElements.whenDefined('bp-sdk-external-vehicle-panel-buttons').then(() => {
            this.useExternal = true;
        });
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return (h("bp-sdk-external-vehicle-panel-buttons", { canDelete: this.canDelete, canEdit: this.canEdit, handleDelete: this.handleDelete, handleEdit: this.handleEdit }));
    }
    renderInternal() {
        return (h("div", { class: "bp-sdk-vehicle-panel-buttons__container" }, this.canEdit && [
            this.canDelete && h("bp-sdk-vehicle-delete-button", { onClick: this.handleDelete }),
            h("bp-sdk-vehicle-edit-button", { onClick: this.handleEdit }),
        ]));
    }
    static get is() { return "bp-sdk-vehicle-panel-buttons"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-vehicle-panel-buttons.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-vehicle-panel-buttons.css"]
        };
    }
    static get properties() {
        return {
            "canDelete": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Can Delete"
                },
                "attribute": "can-delete",
                "reflect": false,
                "defaultValue": "false"
            },
            "canEdit": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Can edit"
                },
                "attribute": "can-edit",
                "reflect": false,
                "defaultValue": "false"
            },
            "handleDelete": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "() => void",
                    "resolved": "() => void",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "On close function hook"
                }
            },
            "handleEdit": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "(e: MouseEvent) => void",
                    "resolved": "(e: MouseEvent) => void",
                    "references": {
                        "MouseEvent": {
                            "location": "global",
                            "id": "global::MouseEvent"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "On open function hook"
                }
            }
        };
    }
    static get states() {
        return {
            "useExternal": {}
        };
    }
}
