import { updateContent } from "../content/edit";
import { updateDiscussion } from "../discussions/edit";
import { updateInitiative } from "../initiatives/HubInitiatives";
import { updateProject } from "../projects/edit";
import { updateSite } from "../sites/HubSites";
import { updatePage } from "../pages/HubPages";
import { updateInitiativeTemplate } from "../initiative-templates/edit";
import { updateTemplate } from "../templates/edit";
import { updateHubEvent } from "../events/edit";
import { updateHubGroup } from "../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
 */
export const updateHubEntity = async (type, entity, context) => {
    let result;
    switch (type) {
        case "project":
            result = await updateProject(entity, context.userRequestOptions);
            break;
        case "site":
            result = await updateSite(entity, context.hubRequestOptions);
            break;
        case "initiative":
            result = await updateInitiative(entity, context.userRequestOptions);
            break;
        case "discussion":
            result = await updateDiscussion(entity, context.hubRequestOptions);
            break;
        case "content":
            result = await updateContent(entity, context.hubRequestOptions);
            break;
        case "page":
            result = await updatePage(entity, context.userRequestOptions);
            break;
        case "template":
            result = await updateTemplate(entity, context.userRequestOptions);
            break;
        case "initiativeTemplate":
            result = await updateInitiativeTemplate(entity, context.userRequestOptions);
            break;
        case "group":
            result = await updateHubGroup(entity, context);
            break;
        case "event":
            result = await updateHubEvent(entity, context.hubRequestOptions);
            break;
    }
    return result;
};
//# sourceMappingURL=updateHubEntity.js.map