import { h } from "@stencil/core";
export class BpSdkBusinessClassificationSelectorRelevanceChip {
    constructor() {
        this.confidence = undefined;
        this.useExternal = false;
        this.relevance = 'high';
    }
    onConfidenceChange(confidence) {
        let relevance = 'High';
        if (confidence === 1) {
            relevance = 'Medium';
        }
        else if (confidence <= 0) {
            relevance = 'Low';
        }
        this.relevance = relevance;
    }
    resetState() { }
    connectedCallback() {
        this.resetState();
    }
    componentWillLoad() {
        this.useExternal = !!customElements.get('bp-sdk-external-business-classification-selector-relevance-chip');
        customElements.whenDefined('bp-sdk-external-business-classification-selector-relevance-chip').then(() => {
            this.useExternal = true;
        });
        this.onConfidenceChange(this.confidence);
    }
    render() {
        return [this.useExternal && this.renderExternal(), !this.useExternal && this.renderInternal()];
    }
    renderExternal() {
        return h("bp-sdk-external-business-classification-selector-relevance-chip", { confidence: this.confidence });
    }
    renderInternal() {
        return (h("span", { class: "bp-sdk-business-classification-selector-relevance-chip__container" }, h("span", { class: "bp-sdk-business-classification-selector-relevance-chip__wrapper" }, h("span", { class: "bp-sdk-business-classification-selector-relevance-chip__content" }, this.relevance, " Relevance"))));
    }
    static get is() { return "bp-sdk-business-classification-selector-relevance-chip"; }
    static get originalStyleUrls() {
        return {
            "$": ["./bp-sdk-business-classification-selector-relevance-chip.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bp-sdk-business-classification-selector-relevance-chip.css"]
        };
    }
    static get properties() {
        return {
            "confidence": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Confidence level"
                },
                "attribute": "confidence",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "useExternal": {},
            "relevance": {}
        };
    }
    static get watchers() {
        return [{
                "propName": "confidence",
                "methodName": "onConfidenceChange"
            }];
    }
}
