"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.buildNotificationEvent = buildNotificationEvent;
exports.getNotificationEventValue = getNotificationEventValue;
var _constants = require("../../../../../core/constants");
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
var _constants2 = require("../constants");
function getNotificationEventValue(events, eventName) {
  var _event$rolesFilter;
  const event = events === null || events === void 0 ? void 0 : events.find(e => e.eventName === eventName);
  if (!event || !event.isEnabled) return _constants2.NOTIFICATION_RADIO_OPTIONS.off;
  if (((_event$rolesFilter = event.rolesFilter) === null || _event$rolesFilter === void 0 ? void 0 : _event$rolesFilter.type) === _tsSdkReactNative.NotificationRolesFilterTypeEnum.ONLY) return _constants2.NOTIFICATION_RADIO_OPTIONS.onlyModerator;
  return _constants2.NOTIFICATION_RADIO_OPTIONS.everyone;
}
function buildNotificationEvent(eventName, value) {
  if (value === _constants2.NOTIFICATION_RADIO_OPTIONS.off) return {
    eventName,
    isEnabled: false
  };
  return {
    eventName,
    isEnabled: true,
    rolesFilter: value === _constants2.NOTIFICATION_RADIO_OPTIONS.onlyModerator ? {
      type: _tsSdkReactNative.NotificationRolesFilterTypeEnum.ONLY,
      roleIds: [_constants.MemberRoles.COMMUNITY_MODERATOR]
    } : {
      type: _tsSdkReactNative.NotificationRolesFilterTypeEnum.ALL
    }
  };
}
//# sourceMappingURL=index.js.map