var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { InputState } from '../../mixins/input-state/input-state';
import { ModulVue } from '../../utils/vue/vue';
import { ACCORDION_TRANSITION_NAME, ICON_NAME, VALIDATION_MESSAGE_NAME } from '../component-names';
import IconPlugin, { MIcon } from '../icon/icon';
import AccordionTransitionPlugin, { MAccordionTransition } from '../transitions/accordion-transition/accordion-transition';
import WithRender from './validation-message.html?style=./validation-message.scss';
var MValidationMessage = /** @class */ (function (_super) {
    __extends(MValidationMessage, _super);
    function MValidationMessage() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.classMessage = '';
        return _this;
    }
    MValidationMessage.prototype.onClick = function (event) { };
    Object.defineProperty(MValidationMessage.prototype, "message", {
        get: function () {
            var message;
            if (this.as().hasErrorMessage && this.as().hasError) {
                this.classMessage = 'error';
                this.svgTitle = this.$i18n.translate('m-validation-message:title-error-icon');
                this.iconName = 'm-svg__error';
                message = this.as().errorMessage;
            }
            if (this.as().hasValidMessage && this.as().isValid) {
                this.classMessage = 'valid';
                this.svgTitle = this.$i18n.translate('m-validation-message:title-valid-icon');
                this.iconName = 'm-svg__confirmation';
                message = this.as().validMessage;
            }
            return message;
        },
        enumerable: true,
        configurable: true
    });
    __decorate([
        Prop({ default: true })
    ], MValidationMessage.prototype, "transition", void 0);
    __decorate([
        Emit('click')
    ], MValidationMessage.prototype, "onClick", null);
    MValidationMessage = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[ICON_NAME] = MIcon,
                _a[ACCORDION_TRANSITION_NAME] = MAccordionTransition,
                _a),
            mixins: [InputState]
        })
    ], MValidationMessage);
    return MValidationMessage;
}(ModulVue));
export { MValidationMessage };
var ValidationMessagePlugin = {
    install: function (v, options) {
        v.use(IconPlugin);
        v.use(AccordionTransitionPlugin);
        v.component(VALIDATION_MESSAGE_NAME, MValidationMessage);
    }
};
export default ValidationMessagePlugin;
//# sourceMappingURL=validation-message.js.map