import { shareEventWithGroups } from "../events/_internal/shareEventWithGroups";
import { getTypeFromEntity } from "./getTypeFromEntity";
import { shareItemToGroups } from "../items/share-item-to-groups";
/**
 * Shares an entity to one or more groups
 * @param entity An IHubItemEntity object
 * @param groupIds An array of group IDs to share the entity to
 * @param context An IArcGISContext object
 * @returns a promise that resolves the updated entity
 */
export async function shareEntityWithGroups(entity, groupIds, context) {
    const type = getTypeFromEntity(entity);
    let results;
    switch (type) {
        case "event":
            results = await shareEventWithGroups(groupIds, entity, context);
            break;
        default:
            results = entity;
            await shareItemToGroups(entity.id, groupIds, context.requestOptions, entity.owner);
            break;
    }
    return results;
}
//# sourceMappingURL=shareEntityWithGroups.js.map