"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isModerator = exports.isMember = exports.isAdmin = void 0;
var _constants = require("../constants");
const ADMIN = 'global-admin';
const {
  COMMUNITY_MODERATOR,
  CHANNEL_MODERATOR,
  MODERATOR,
  SUPER_MODERATOR,
  MEMBER
} = _constants.MemberRoles;
const isMember = userRoles => {
  if (!(userRoles !== null && userRoles !== void 0 && userRoles.length)) {
    return false;
  }
  return userRoles.includes(MEMBER);
};
exports.isMember = isMember;
const isModerator = userRoles => {
  if (!(userRoles !== null && userRoles !== void 0 && userRoles.length)) {
    return false;
  }
  const roles = [COMMUNITY_MODERATOR, CHANNEL_MODERATOR, MODERATOR, SUPER_MODERATOR];
  return userRoles.some(role => roles.includes(role));
};
exports.isModerator = isModerator;
const isAdmin = userRoles => {
  if (!(userRoles !== null && userRoles !== void 0 && userRoles.length)) {
    return false;
  }
  return userRoles.includes(ADMIN);
};
exports.isAdmin = isAdmin;
//# sourceMappingURL=role.js.map