"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unsuspendAllInList = exports.suspendAllInList = exports.changeIsSuspendInList = void 0;
/**
 * Updates IsSuspended in a list of adaptable objects
 *
 * @param abObjectToChange object to suspend
 * @param list list of ab objects
 */
function changeIsSuspendInList(abObjectToChange, list, IsSuspended) {
    return list.map((abObject) => {
        if (!abObject.IsReadOnly && (abObject === null || abObject === void 0 ? void 0 : abObject.Uuid) === (abObjectToChange === null || abObjectToChange === void 0 ? void 0 : abObjectToChange.Uuid)) {
            return Object.assign(Object.assign({}, abObject), { IsSuspended: IsSuspended });
        }
        return abObject;
    });
}
exports.changeIsSuspendInList = changeIsSuspendInList;
function suspendAllInList(list) {
    return list.map((abObject) => {
        if (!abObject.IsReadOnly) {
            return Object.assign(Object.assign({}, abObject), { IsSuspended: true });
        }
        return abObject;
    });
}
exports.suspendAllInList = suspendAllInList;
function unsuspendAllInList(list) {
    return list.map((abObject) => {
        if (!abObject.IsReadOnly) {
            return Object.assign(Object.assign({}, abObject), { IsSuspended: false });
        }
        return abObject;
    });
}
exports.unsuspendAllInList = unsuspendAllInList;
