import Axios from 'axios'

import {
  PERFORM_TASK_TOTAL, ALARMCOUNTS_GET,
  PERFORM_TASK, PERFORM_TASK_QUERY, PERFORM_TASK_STATUS, REQUEST_CONFIG
} from '../../utils/RequestUrls'
var staticMethods = {
  /**
   * @Description  : 获取所有
   * @author       : ls
   * @date         : 2020/4/27 16:42
   * @param        :
   * @return       :
   */
  getCollectTaskCollection: function () {
    return Axios.get(PERFORM_TASK)
  },
  /**
   * @Description  : chuanjianAPI
   * @author       : ls
   * @date         : 2020/4/27 16:42
   * @param        :
   * @return       :
   */
  postAddCollectTask: function (colTask) {
    return Axios.post(PERFORM_TASK, colTask, REQUEST_CONFIG)
  },

  /**
   * @Description  : shanchu
   * @author       : ls
   * @date         : 2020/4/27 9:55
   * @param        :
   * @return       :
   */
  deleteDeleteCollectTask: function (keyList) {
    return Axios.delete(PERFORM_TASK, {
      data: keyList,
      headers: {'Content-Type': 'application/json', 'Encoding': 'utf-8'}
    })
  },

  /**
   * @Description  : 修改
   * @author       : ls
   * @date         : 2020/4/27 16:44
   * @param        :
   * @return       :
   */
  putModifyCollectTask: function (colTask) {
    return Axios.put(PERFORM_TASK, colTask, REQUEST_CONFIG)
  },
  /**
   * @Description  : 启用
   * @author       : ls
   * @date         : 2020/4/29 16:13
   * @param        :
   * @return       :
   */
  putStartCollectTask: function (val) {
    return Axios.put(PERFORM_TASK_STATUS, val, REQUEST_CONFIG)
  },

  /**
   * @Description  : 条件查询
   * @author       : ls
   * @date         : 2020/4/27 10:33
   * @param        :
   * @return       :
   */
  putConditionQueryCollectTask: function (conditionSet) {
    return Axios.put(PERFORM_TASK_QUERY, conditionSet, REQUEST_CONFIG)
  },
  /**
   * @Description  : 分页
   * @author       : ls
   * @date         : 2020/5/26 14:59
   * @param        :
   * @return       :
   */
  queryCollectTaskPaging: function (beginItem, endItem, selectList) {
    return Axios.put(PERFORM_TASK_QUERY + '/' + beginItem + '/' + endItem + '/', selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : 查询总数
   * @author       : ls
   * @date         : 2020/5/26 15:05
   * @param        :
   * @return       :
   */
  getCollectTaskCounts: function (selectList) {
    return Axios.put(PERFORM_TASK_TOTAL, selectList, REQUEST_CONFIG)
  }
}

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