"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.importSettingsOfObject = importSettingsOfObject;
const common_1 = require("../../common");
const decorators_1 = require("../../common/decoration/decorators");
/**
 * Transfers settings from manifest to object page config.
 *
 * @param configPart - part of the configuration to be filled
 * @param manifest - manifest.json of the app
 * @param appSchema - app specific schema
 * @param pageKey - Key of the page in the manifest
 * @param breadcrumbs - Array of breadcrumb strings representing the navigation path
 * @param sectionId (optional) - ID of the given section (optional)
 * @param {ExtensionLogger} logger - Logger class for logging messages
 */
function importSettingsOfObject(configPart, manifest, appSchema, pageKey, breadcrumbs, sectionId, logger) {
    if (!appSchema) {
        return;
    }
    let manifestSection = {};
    const deprecatedProperties = configPart?.getDeprecated;
    const targetAnnotationEncoded = sectionId && sectionId.replace('/', '::');
    for (const propertyKey in appSchema['properties']) {
        const syncRule = (0, decorators_1.getReflectMetadata)(configPart, propertyKey);
        if (syncRule?.manifest) {
            const path = syncRule.manifest.path([pageKey], manifest, targetAnnotationEncoded, ...breadcrumbs);
            manifestSection = (0, common_1.getManifestSectionByPathV4)(manifest, path, sectionId, targetAnnotationEncoded, true);
            if (manifestSection && Object.keys(manifestSection).length > 0) {
                (0, common_1.importProperty)(syncRule, manifestSection, propertyKey, configPart, sectionId, breadcrumbs);
                (0, common_1.checkDeprecatedProperties)(deprecatedProperties, manifestSection, path, logger);
            }
        }
    }
}
//# sourceMappingURL=utils.js.map