
// 静态方法
import HelperUtil from "../../utils/HelperUtil";
import {CABINET_KEY, LOCATION_KEY,CABINET_DOWNLOAD_FILE_NAME,DOWNLOAD_SYSTEM_CONFIG_NAME} from "../../utils/constantCollection";
import CabinetAPI from "../../api/restApis/CabinetAPI";
import SystemConfigAPI from "../../api/restApis/SystemConfigAPI";

let staticMethods = {
  /**
  * @Author      : lS
  * @Date        : 14:59 2019/11/18
  * @Description : 上传配置
  **/
  uploadSystemConfig: function (url, ope, fileData) {
    return SystemConfigAPI.postUploadSystemConfig(url, ope, fileData).then(result => {
      if (result.data.result) {
      } else {
        return HelperUtil.returnPromiseRejectObj(result)
      }
    })
  },
  /**
  * @Author      : lS
  * @Date        : 14:59 2019/11/18
  * @Description : 下载配置
  **/
  downloadSystemConfig: function (selcetConfig) {
    return SystemConfigAPI.putDownloadSystemConfig(selcetConfig).then(result => {
      return HelperUtil.downFile(result, DOWNLOAD_SYSTEM_CONFIG_NAME)
    })
  }
};

function SystemConfigService (websocketService = null) {

  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(SystemConfigService, staticMethods);
export default SystemConfigService;
