"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.migrateWebMappingApplicationSites = migrateWebMappingApplicationSites;
const get_prop_1 = require("../../objects/get-prop");
const get_with_default_1 = require("../../objects/get-with-default");
/**
 * Early Hub sites were persisted as items of type "Web Mapping
 * Application" with a typeKeyword of "hubSite". We want these
 * items to act like regular "Hub Site Application"s, so we add
 * this versionless migration to artificially update the type
 * of old site items.
 *
 * Note: this change won't be persisted on the item itself,
 * which is why this migration must always run.
 *
 * @param model Site Model
 * @private
 */
function migrateWebMappingApplicationSites(model) {
    const isWebMappingApplication = (0, get_prop_1.getProp)(model, "item.type") === "Web Mapping Application";
    const hasHubSiteKeyword = (0, get_with_default_1.getWithDefault)(model, "item.typeKeywords", []).includes("hubSite");
    if (isWebMappingApplication && hasHubSiteKeyword) {
        model.item.type = "Hub Site Application";
    }
    return model;
}
//# sourceMappingURL=migrateWebMappingApplicationSites.js.map