"use strict";exports.__esModule = true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}var _Constants=require("../Constants");var ChannelPermissions=(function(){function ChannelPermissions(permissions){_classCallCheck(this,ChannelPermissions);this.permissions = permissions;}ChannelPermissions.prototype.serialise = function serialise(explicit){var _this=this;var hp=function hp(perm){return _this.hasPermission(perm,explicit);};return { // general
createInstantInvite:hp(_Constants.Permissions.createInstantInvite),kickMembers:hp(_Constants.Permissions.kickMembers),banMembers:hp(_Constants.Permissions.banMembers),managePermissions:hp(_Constants.Permissions.managePermissions),manageChannel:hp(_Constants.Permissions.manageChannel),manageServer:hp(_Constants.Permissions.manageServer), // text
readMessages:hp(_Constants.Permissions.readMessages),sendMessages:hp(_Constants.Permissions.sendMessages),sendTTSMessages:hp(_Constants.Permissions.sendTTSMessages),manageMessages:hp(_Constants.Permissions.manageMessages),embedLinks:hp(_Constants.Permissions.embedLinks),attachFiles:hp(_Constants.Permissions.attachFiles),readMessageHistory:hp(_Constants.Permissions.readMessageHistory),mentionEveryone:hp(_Constants.Permissions.mentionEveryone), // voice
voiceConnect:hp(_Constants.Permissions.voiceConnect),voiceSpeak:hp(_Constants.Permissions.voiceSpeak),voiceMuteMembers:hp(_Constants.Permissions.voiceMuteMembers),voiceDeafenMembers:hp(_Constants.Permissions.voiceDeafenMembers),voiceMoveMembers:hp(_Constants.Permissions.voiceMoveMembers),voiceUseVAD:hp(_Constants.Permissions.voiceUseVAD)};};ChannelPermissions.prototype.serialize = function serialize(){ // ;n;
return this.serialise();};ChannelPermissions.prototype.hasPermission = function hasPermission(perm){var explicit=arguments.length <= 1 || arguments[1] === undefined?false:arguments[1];if(perm instanceof String || typeof perm === "string"){perm = _Constants.Permissions[perm];}if(!perm){return false;}if(!explicit){ // implicit permissions allowed
if(!!(this.permissions & _Constants.Permissions.manageRoles)){ // manageRoles allowed, they have all permissions
return true;}}return !!(this.permissions & perm);};return ChannelPermissions;})();exports["default"] = ChannelPermissions;module.exports = exports["default"];
