import Axios from 'axios'

import {
  REPORT_TEMPLATE, REQUEST_CONFIG, REPORT_TEMPLATE_QUERY, PERFORMANCE_QUERY, REPORT_TEMPLATE_TOTAL
} from '../../utils/RequestUrls'

var staticMethods = {
  /**
   * @Description  : 分页查询API
   * @author       : ls
   * @date         : 2020/5/6 16:16
   * @param        :
   * @return       :
   */
  putReportTemListQueryterms: function (beginItem, endItem, selectList) {
    return Axios.put(REPORT_TEMPLATE_QUERY + '/' + beginItem + '/' + endItem + '/', selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : 查询总页数
   * @author       : ls
   * @date         : 2020/5/6 16:06
   * @param        :
   * @return       :
   */
  putReportTemplateListCounts: function (selectList) {
    return Axios.put(REPORT_TEMPLATE_TOTAL, selectList, REQUEST_CONFIG)
  },
  /**
   * @Description  : 创建报表模板
   * @author       : ls
   * @date         : 2020/5/2 14:14
   * @param        :
   * @return       :
   */
  addReportTemplate: function (template) {
    return Axios.post(REPORT_TEMPLATE, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : 修改报表模板
   * @author       : ls
   * @date         : 2020/5/2 14:15
   * @param        :
   * @return       :
   */
  putModifyReportTemplate: function (template) {
    return Axios.put(REPORT_TEMPLATE, template, REQUEST_CONFIG)
  },
  /**
   * @Description  : 删除
   * @author       : ls
   * @date         : 2020/5/2 14:15
   * @param        :
   * @return       :
   */
  deleteDeleteReportTemplate: function (keyList) {
    return Axios.delete(REPORT_TEMPLATE, {
      data: keyList,
      headers: {'Content-Type': 'application/json', 'Encoding': 'utf-8'}
    })
  },
  /**
   * @Description  : 获取所有
   * @author       : ls
   * @date         : 2020/5/2 14:16
   * @param        :
   * @return       :
   */
  getReportTemplateCollection: function () {
    return Axios.get(REPORT_TEMPLATE)
  },
  /**
   * @Description  : 条件查询
   * @author       : ls
   * @date         : 2020/5/2 14:16
   * @param        :
   * @return       :
   */
  putReportTemplateCollection: function (conditionSet) {
    return Axios.put(REPORT_TEMPLATE_QUERY, conditionSet, REQUEST_CONFIG)
  }
}

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