import Axios from 'axios'

import {
  REPORT_TASK_TOTAL, REPORT_TASK, REPORT_TASK_QUERY, REPORT_TASK_STATUS, REQUEST_CONFIG
} from '../../utils/RequestUrls'
var staticMethods = {
  /**
   * @Description  : 获取所有
   * @author       : ls
   * @date         : 2020/4/27 16:42
   * @param        :
   * @return       :
   */
  getReportTaskCollection: function () {
    return Axios.get(REPORT_TASK)
  },
  /**
   * @Description  : chuanjianAPI
   * @author       : ls
   * @date         : 2020/4/27 16:42
   * @param        :
   * @return       :
   */
  postAddReportTask: function (colTask) {
    return Axios.post(REPORT_TASK, colTask, REQUEST_CONFIG)
  },

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

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

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

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