import Axios from 'axios'

import {CONFIG_FILE_DIFFERENCE_ADMQ, CONFIG_FILE_DIFFERENCE_VIEW, REQUEST_CONFIG,CONFIG_FILE_DIFFERENCE_HANDLE} from '../../utils/RequestUrls'

var staticMethods = {

  // 获取所有配置文件差异性信息
  getConfigFileDifferenceCollection: function () {
    return Axios.get(CONFIG_FILE_DIFFERENCE_ADMQ)
  },

  //查看配置文件差异性
  viewFileByUser: function (fileDiffererntMessage,fileType) {
    return Axios.put(CONFIG_FILE_DIFFERENCE_VIEW + fileType,fileDiffererntMessage,{
      headers: {
        'Content-Type': 'application/json'
      },
      responseType: 'arraybuffer'
    })
  },

  //操作配置文件差异性
  handleFileByUser: function (fileDiffererntMessage,userOption) {
  return Axios.put(CONFIG_FILE_DIFFERENCE_HANDLE + userOption,fileDiffererntMessage, REQUEST_CONFIG)
}
}



function ConfigFileDifferenceAPI (websocketService = null) {
  return Object.freeze(Object.assign(
    {
      // object methods comes here
    },
    staticMethods
  ))
}
// inject static methods
Object.assign(ConfigFileDifferenceAPI, staticMethods)
export default ConfigFileDifferenceAPI
