"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateContent = void 0;
const antd_1 = require("antd");
const index_1 = require("@/foxI18n/index");
const utils_1 = require("../utils");
/**
 * content validator
 * @param pageContent page content
 * @param opt options
 */
const validateContent = (pageContent, opt) => {
    const { content } = pageContent;
    const { relations, showMsg = true } = opt;
    const { relation, invalids } = (0, utils_1.initRelation)(content, relations);
    content.relation = relation;
    if (invalids.length > 0) {
        if (showMsg) {
            const { builder: { relationMatchError }, } = (0, index_1.getBusinessI18n)();
            antd_1.message.error(`[ ${invalids.toString()} ] ${relationMatchError}`);
        }
        return false;
    }
    return true;
};
exports.validateContent = validateContent;
