"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEntityGroups = getEntityGroups;
const getEventGroups_1 = require("../events/getEventGroups");
const sharedWith_1 = require("./_internal/sharedWith");
const getTypeFromEntity_1 = require("./getTypeFromEntity");
/**
 * Fetches an array of groups the entity is shared with
 * @param entity An IHubItemEntity
 * @param context An IArcGISContext
 * @returns a promise that resolves an array of groups the entity is shared with
 */
async function getEntityGroups(entity, context) {
    const type = (0, getTypeFromEntity_1.getTypeFromEntity)(entity);
    let groups;
    switch (type) {
        case "event":
            groups = await (0, getEventGroups_1.getEventGroups)(entity.id, context);
            break;
        default:
            groups = await (0, sharedWith_1.sharedWith)(entity.id, context.requestOptions);
            break;
    }
    return groups;
}
//# sourceMappingURL=getEntityGroups.js.map