"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeHubContent = void 0;
const compose_1 = require("./compose");
const set_prop_1 = require("../objects/set-prop");
const modelToHubEditableContent_1 = require("./modelToHubEditableContent");
const util_1 = require("../util");
/**
 * composes a Hub content entity from an item and optional enrichments
 * @param item item to compose content from
 * @param requestOptions request options (needed to determine certain urls)
 * @param enrichments enrichments to use during composition
 * @returns content entity
 */
const composeHubContent = (item, requestOptions, enrichments) => {
    // we must normalize the underlying item type to account
    // for older items (e.g. sites that are type "Web Mapping
    // Application") before we map the model to a Hub Entity
    const normalizedItem = (0, util_1.cloneObject)(item);
    const type = (0, compose_1.normalizeItemType)(item);
    (0, set_prop_1.setProp)("type", type, normalizedItem);
    return (0, modelToHubEditableContent_1.modelToHubEditableContent)({ item: normalizedItem }, requestOptions, enrichments);
};
exports.composeHubContent = composeHubContent;
//# sourceMappingURL=composeHubContent.js.map