"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.autoAddUsersAsAdmins = autoAddUsersAsAdmins;
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
/**
 * @private
 * Auto add N users to a single group, with users added as admins of that group
 *
 * @export
 * @param {string} id Group ID
 * @param {IUser[]} admins array of users to add to group as admin
 * @param {IAuthenticationManager} authentication authentication manager
 * @return {IAddGroupUsersResult} Result of the transaction (null if no users are passed in)
 */
function autoAddUsersAsAdmins(id, admins, authentication) {
    let response = Promise.resolve(null);
    if (admins.length) {
        const args = {
            id,
            admins: admins.map((a) => a.username),
            authentication,
        };
        response = (0, arcgis_rest_portal_1.addGroupUsers)(args);
    }
    return response;
}
//# sourceMappingURL=autoAddUsersAsAdmins.js.map