"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unshareEntityWithGroups = unshareEntityWithGroups;
const unshareEventWithGroups_1 = require("../events/_internal/unshareEventWithGroups");
const getTypeFromEntity_1 = require("./getTypeFromEntity");
const unshare_item_from_groups_1 = require("../items/unshare-item-from-groups");
/**
 * Unshares an entity from one or more groups
 * @param entity An IHubItemEntity object
 * @param groupIds An array of group IDs to unshare the entity from
 * @param context An IArcGISContext object
 * @returns a promise that resolves the updated entity
 */
async function unshareEntityWithGroups(entity, groupIds, context) {
    const type = (0, getTypeFromEntity_1.getTypeFromEntity)(entity);
    let results;
    switch (type) {
        case "event":
            results = await (0, unshareEventWithGroups_1.unshareEventWithGroups)(groupIds, entity, context);
            break;
        default:
            results = entity;
            await (0, unshare_item_from_groups_1.unshareItemFromGroups)(entity.id, groupIds, context.requestOptions, entity.owner);
            break;
    }
    return results;
}
//# sourceMappingURL=unshareEntityWithGroups.js.map