var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import { ModulIconName } from '../../utils/modul-icons/modul-icons';
import { ModulVue } from '../../utils/vue/vue';
import { ICON_NAME, LINK_NAME, MESSAGE_PAGE_NAME, SVG_NAME } from '../component-names';
import { MIcon } from '../icon/icon';
import { MLink } from '../link/link';
import { MSvg } from './../svg/svg';
import WithRender from './message-page.html?style=./message-page.scss';
/**
 * Utility class to manage the properties related to the link displayed in the error pages.
 */
var Link = /** @class */ (function () {
    /**
     * Constructor
     * @param label Label for the url link to display.
     * @param url Target for the location to navigate to, can be relative.
     * @param external Defines to the target is external (opens in new tab), or internal (opens in same tab) to the application.
     */
    function Link(label, url, external) {
        if (external === void 0) { external = false; }
        this.label = label;
        this.url = url;
        this.external = external;
    }
    return Link;
}());
export { Link };
export var MMessagePageSkin;
(function (MMessagePageSkin) {
    MMessagePageSkin["Default"] = "default";
    MMessagePageSkin["Light"] = "light";
})(MMessagePageSkin || (MMessagePageSkin = {}));
export var MMessagePageImageSize;
(function (MMessagePageImageSize) {
    MMessagePageImageSize["Default"] = "130px";
    MMessagePageImageSize["Small"] = "76px";
})(MMessagePageImageSize || (MMessagePageImageSize = {}));
export var MMessagePageState;
(function (MMessagePageState) {
    MMessagePageState["Information"] = "information";
    MMessagePageState["Warning"] = "warning";
    MMessagePageState["Confirmation"] = "confirmation";
    MMessagePageState["Error"] = "error";
})(MMessagePageState || (MMessagePageState = {}));
var MMessagePage = /** @class */ (function (_super) {
    __extends(MMessagePage, _super);
    function MMessagePage() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Object.defineProperty(MMessagePage.prototype, "hasHints", {
        get: function () {
            return this.hints.length > 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "hasLinks", {
        get: function () {
            return this.links.length > 0;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "propImageSize", {
        get: function () {
            if (this.imageSize) {
                return this.imageSize;
            }
            return this.isSkinLight ? MMessagePageImageSize.Small : MMessagePageImageSize.Default;
        },
        enumerable: false,
        configurable: true
    });
    MMessagePage.prototype.isTargetExternal = function (isExternal) {
        return isExternal ? '_blank' : '';
    };
    Object.defineProperty(MMessagePage.prototype, "hasLinksAndSlot", {
        get: function () {
            return this.hasLinks || !!this.$slots.default;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "hasBody", {
        get: function () {
            return this.hasHints || this.hasLinks || !!this.$slots.default;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isSkinDefault", {
        get: function () {
            return this.skin === MMessagePageSkin.Default;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isSkinLight", {
        get: function () {
            return this.skin === MMessagePageSkin.Light;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isStateInformation", {
        get: function () {
            return this.state === MMessagePageState.Information;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isStateWarning", {
        get: function () {
            return this.state === MMessagePageState.Warning;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isStateError", {
        get: function () {
            return this.state === MMessagePageState.Error;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "isStateConfirmation", {
        get: function () {
            return this.state === MMessagePageState.Confirmation;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MMessagePage.prototype, "iconNameProp", {
        get: function () {
            if (this.iconName) {
                return this.iconName;
            }
            else {
                switch (this.state) {
                    case MMessagePageState.Confirmation:
                        return ModulIconName.ConfirmationWhiteFilled;
                    case MMessagePageState.Information:
                        return ModulIconName.InformationWhiteFilled;
                    case MMessagePageState.Warning:
                        return ModulIconName.WarningWhiteFilled;
                    default:
                        return ModulIconName.ErrorWhiteFilled;
                }
            }
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop({
            default: 'error',
            validator: function (value) {
                return value === MMessagePageState.Information ||
                    value === MMessagePageState.Warning ||
                    value === MMessagePageState.Confirmation ||
                    value === MMessagePageState.Error;
            }
        })
    ], MMessagePage.prototype, "state", void 0);
    __decorate([
        Prop({
            default: MMessagePageSkin.Default,
            validator: function (value) {
                return value === MMessagePageSkin.Default ||
                    value === MMessagePageSkin.Light;
            }
        })
    ], MMessagePage.prototype, "skin", void 0);
    __decorate([
        Prop()
    ], MMessagePage.prototype, "iconName", void 0);
    __decorate([
        Prop({})
    ], MMessagePage.prototype, "svgName", void 0);
    __decorate([
        Prop()
    ], MMessagePage.prototype, "imageSize", void 0);
    __decorate([
        Prop()
    ], MMessagePage.prototype, "title", void 0);
    __decorate([
        Prop({ default: function () { return []; } })
    ], MMessagePage.prototype, "hints", void 0);
    __decorate([
        Prop({ default: function () { return []; } })
    ], MMessagePage.prototype, "links", void 0);
    MMessagePage = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[ICON_NAME] = MIcon,
                _a[LINK_NAME] = MLink,
                _a[SVG_NAME] = MSvg,
                _a)
        })
    ], MMessagePage);
    return MMessagePage;
}(ModulVue));
export { MMessagePage };
var MessagePagePlugin = {
    install: function (v) {
        v.prototype.$log.debug(MESSAGE_PAGE_NAME, 'plugin.install');
        v.component(MESSAGE_PAGE_NAME, MMessagePage);
    }
};
export default MessagePagePlugin;
//# sourceMappingURL=message-page.js.map