// eslint-disable-next-line import/no-unresolved
import { NativeModules } from 'react-native';
import { modeMap, eventMap } from './nameMaps';
import modeManager from '../../common/modeManager';
import client from '../../common/client';

/**
 * 中台直播端适配逻辑
 * 注册中台直播端模块获取策略
 */
if (client.isLive()) {
  modeManager.setGetModeStrategy(moduleName => {
    const newModeName = modeMap[moduleName] || `HYL${moduleName}`;
    return NativeModules[newModeName];
  });

  modeManager.setGetNameStrategy(name => {
    return eventMap[name] || name;
  });
}

export default {};