/*
 * @Author: wangdengzhi
 * @Date: 2020-08-20 10:01:27
 * @Last Modified by: wangdengzhi
 * @Last Modified time: 2020-08-21 14:07:16
 * @description: 通信模块
 */
import createWebService from '@sugarteam/eclass-web-service';
import CustomService from '@sugarteam/web-service';
import documentEventMessager from './documentEventMessager';
import { IService } from './types';
import { Theme } from '../theme/types';

class ServiceFactory {
  constructor() {}
  create() {
    switch (webpack_theme) {
      case Theme.Android:
        return createWebService('webview') as IService;
      case Theme.Student:
      case Theme.Teacher:
        return new CustomService({ messager: documentEventMessager }) as IService;
      default:
        return createWebService('webview') as IService;
    }
  }
}

export default new ServiceFactory();
