import Axios from 'axios'
import {
  CABINET_UPLOAD,
  CABINET_DOWNLOAD,
} from "../../utils/RequestUrls";

var staticMethods = {
  /**
   * @Author      : lS
   * @Date        : 12:05 2019/11/18
   * @Description : 系统配置上传
   **/
  postUploadSystemConfig: function (url, chooseOperation, fileFormData) {
    return Axios.post(url + '/' + chooseOperation, fileFormData,
      {
        headers: {
          'Content-Type': 'multipart/form-data',
          'Accept': 'application/json'
        }
      })
  },
  /**
   * @Author      : lS
   * @Date        : 15:05 2019/11/18
   * @Description : 系统配置数据下载
   **/
  putDownloadSystemConfig: function (url) {
    var arr = []
    return Axios.put(url, arr, {
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'arraybuffer'
    })
  },
};

function SystemConfigAPI (websocketService = null) {

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