"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateHubEntity = void 0;
const edit_1 = require("../content/edit");
const edit_2 = require("../discussions/edit");
const HubInitiatives_1 = require("../initiatives/HubInitiatives");
const edit_3 = require("../projects/edit");
const HubSites_1 = require("../sites/HubSites");
const HubPages_1 = require("../pages/HubPages");
const edit_4 = require("../initiative-templates/edit");
const edit_5 = require("../templates/edit");
const edit_6 = require("../events/edit");
const HubGroups_1 = require("../groups/HubGroups");
/**
 * centralized function to update a Hub entity - delegates
 * to the appropriate update function by entity type
 * @param type
 * @param entity
 * @param context
 * @returns
 */
const updateHubEntity = async (type, entity, context) => {
    let result;
    switch (type) {
        case "project":
            result = await (0, edit_3.updateProject)(entity, context.userRequestOptions);
            break;
        case "site":
            result = await (0, HubSites_1.updateSite)(entity, context.hubRequestOptions);
            break;
        case "initiative":
            result = await (0, HubInitiatives_1.updateInitiative)(entity, context.userRequestOptions);
            break;
        case "discussion":
            result = await (0, edit_2.updateDiscussion)(entity, context.hubRequestOptions);
            break;
        case "content":
            result = await (0, edit_1.updateContent)(entity, context.hubRequestOptions);
            break;
        case "page":
            result = await (0, HubPages_1.updatePage)(entity, context.userRequestOptions);
            break;
        case "template":
            result = await (0, edit_5.updateTemplate)(entity, context.userRequestOptions);
            break;
        case "initiativeTemplate":
            result = await (0, edit_4.updateInitiativeTemplate)(entity, context.userRequestOptions);
            break;
        case "group":
            result = await (0, HubGroups_1.updateHubGroup)(entity, context);
            break;
        case "event":
            result = await (0, edit_6.updateHubEvent)(entity, context.hubRequestOptions);
            break;
    }
    return result;
};
exports.updateHubEntity = updateHubEntity;
//# sourceMappingURL=updateHubEntity.js.map