import { h } from "@stencil/core";
import { FormValidationMessageVariation } from "./form-validation-message-variation.enum";
/**
 * @slot default - Ska vara en textnod eller liknande element. Renderas inne i ett span-element.
 *
 * @enums FormValidationMessageVariation - form-validation-message-variation.enum.ts
 * @swedishName Valideringsmeddelande
 */
export class FormValidationMessage {
    constructor() {
        this.afVariation = FormValidationMessageVariation.SUCCESS;
    }
    get cssModifiers() {
        return {
            'digi-form-validation-message--success': this.afVariation === FormValidationMessageVariation.SUCCESS,
            'digi-form-validation-message--error': this.afVariation === FormValidationMessageVariation.ERROR,
            'digi-form-validation-message--warning': this.afVariation === FormValidationMessageVariation.WARNING
        };
    }
    get icon() {
        switch (this.afVariation) {
            case FormValidationMessageVariation.SUCCESS:
                return h("digi-icon-validation-success", null);
            case FormValidationMessageVariation.ERROR:
                return h("digi-icon-validation-error", null);
            case FormValidationMessageVariation.WARNING:
                return h("digi-icon-validation-warning", { class: "warning" });
        }
    }
    render() {
        return (h("div", { key: '397e813bc6d40303d92437bfa1e4552fc92b980b', class: Object.assign({ 'digi-form-validation-message': true }, this.cssModifiers) }, h("div", { key: 'b2e87b27cfce83f7f7c868f4233a7b912b54473f', class: "digi-form-validation-message__icon", "aria-hidden": "true" }, this.icon), h("span", { key: '62442c92ad270e486f1a28d5a51a9a734d334a85', class: "digi-form-validation-message__text" }, h("slot", { key: '42ea340b45c74cc1003544677712087268809ae4' }))));
    }
    static get is() { return "digi-form-validation-message"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "$": ["form-validation-message.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["form-validation-message.css"]
        };
    }
    static get properties() {
        return {
            "afVariation": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormValidationMessageVariation",
                    "resolved": "FormValidationMessageVariation.ERROR | FormValidationMessageVariation.SUCCESS | FormValidationMessageVariation.WARNING",
                    "references": {
                        "FormValidationMessageVariation": {
                            "location": "import",
                            "path": "./form-validation-message-variation.enum",
                            "id": "src/components/_form/form-validation-message/form-validation-message-variation.enum.ts::FormValidationMessageVariation"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set validation status"
                        }],
                    "text": "S\u00E4tter valideringsstatus. Kan vara 'success', 'error' eller 'warning'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-variation",
                "reflect": false,
                "defaultValue": "FormValidationMessageVariation.SUCCESS"
            }
        };
    }
    static get elementRef() { return "hostElement"; }
}
