import { canReadChannelV2 } from "../channels/can-read-channel-v2";
/**
 * Utility that determines whether a Channel allows a given PostReaction
 * and whether the User has permissions to create it
 *
 * @export
 * @param {IChannel} channel
 * @param {PostReaction} value
 * @return {*}  {boolean}
 */
export function canCreateReactionV2(channel, value, user = {}) {
    if (!channelAllowsReaction(channel, value)) {
        return false;
    }
    return canReadChannelV2(channel, user);
}
function channelAllowsReaction(channel, value) {
    const { allowReaction, allowedReactions } = channel;
    if (!allowReaction) {
        return false;
    }
    if (allowedReactions) {
        return allowedReactions.includes(value);
    }
    return true;
}
//# sourceMappingURL=can-create-reaction-v2.js.map