import { MemberRoles } from '../../../../../core/constants';
import { NotificationRolesFilterTypeEnum } from '@amityco/ts-sdk-react-native';
import { NOTIFICATION_RADIO_OPTIONS } from '../constants';
export 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 NOTIFICATION_RADIO_OPTIONS.off;
  if (((_event$rolesFilter = event.rolesFilter) === null || _event$rolesFilter === void 0 ? void 0 : _event$rolesFilter.type) === NotificationRolesFilterTypeEnum.ONLY) return NOTIFICATION_RADIO_OPTIONS.onlyModerator;
  return NOTIFICATION_RADIO_OPTIONS.everyone;
}
export function buildNotificationEvent(eventName, value) {
  if (value === NOTIFICATION_RADIO_OPTIONS.off) return {
    eventName,
    isEnabled: false
  };
  return {
    eventName,
    isEnabled: true,
    rolesFilter: value === NOTIFICATION_RADIO_OPTIONS.onlyModerator ? {
      type: NotificationRolesFilterTypeEnum.ONLY,
      roleIds: [MemberRoles.COMMUNITY_MODERATOR]
    } : {
      type: NotificationRolesFilterTypeEnum.ALL
    }
  };
}
//# sourceMappingURL=index.js.map