"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.canEditChannelV2 = canEditChannelV2;
const channel_permission_1 = require("../channel-permission");
const portal_privilege_1 = require("../portal-privilege");
/**
 * Utility to determine if User has privileges to edit a channel
 * @export
 * @param channel
 * @param user
 * @param updateData
 * @returns {boolean}
 */
function canEditChannelV2(channel, user = {}, updateData) {
    if ((0, portal_privilege_1.hasOrgAdminUpdateRights)(user, channel.orgId)) {
        return true;
    }
    const channelPermission = new channel_permission_1.ChannelPermission(channel);
    return (channelPermission.canModerateChannel(user) &&
        channelPermission.canUpdateProperties(user, updateData));
}
//# sourceMappingURL=can-edit-channel-v2.js.map