"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidationErrorRendering = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = tslib_1.__importDefault(require("react"));
const styled_components_1 = tslib_1.__importDefault(require("styled-components"));
const IDesignValidationProvider_1 = require("@appglue/common/dist/Common/IDesignValidationProvider");
const NotificationRendering_1 = require("./NotificationRendering");
const FormDesignConstants_1 = require("../Utilities/FormDesignConstants");
const ValidationErrorRenderingDiv = styled_components_1.default.div `
    position: absolute;
    bottom: 24px;
    left: 24px;
    display: flex;
    z-index: 200;

    > * {
        margin-right: 16px;
    }
`;
class ValidationErrorRendering extends react_1.default.Component {
    render() {
        let errors = [];
        let warnings = [];
        this.props.validations.forEach((v) => {
            if (v.level === IDesignValidationProvider_1.ValidationLevel.ERROR) {
                errors.push(v);
            }
            else if (v.level === IDesignValidationProvider_1.ValidationLevel.WARNING) {
                warnings.push(v);
            }
        });
        return ((0, jsx_runtime_1.jsxs)(ValidationErrorRenderingDiv, { children: [errors.length > 0 && (0, jsx_runtime_1.jsx)(NotificationRendering_1.NotificationRendering, { messages: errors, type: FormDesignConstants_1.NotificationType.ERROR }), warnings.length > 0 && (0, jsx_runtime_1.jsx)(NotificationRendering_1.NotificationRendering, { messages: warnings, type: FormDesignConstants_1.NotificationType.WARNING })] }));
    }
}
exports.ValidationErrorRendering = ValidationErrorRendering;
//# sourceMappingURL=ValidationErrorRendering.js.map