import request from '@/utils/request'
import constant from '@/constant'

function pageList(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/pageList", formData);
}

function create() {
  return request.get(constant.serverUrl + "/base/deviceInfo/create");
}

function edit(id) {
  return request.get(constant.serverUrl + "/base/deviceInfo/edit/" + id);
}

function add(formModel) {
  return request.post(constant.serverUrl + "/base/deviceInfo/add", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

function update(formModel) {
  return request.post(constant.serverUrl + "/base/deviceInfo/update", formModel, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

function remove(id) {
  return request.post(constant.serverUrl + "/base/deviceInfo/delete/" + id);
}

function batchRemove(idList) {
  return request.post(constant.serverUrl + "/base/deviceInfo/batchDelete", idList, {
    headers: {
      "Content-Type": "application/json"
    }
  });
}

function getByIpAddressAndPort(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/getByIpAddressAndPort", formData);
}

function list() {
  return request.post(constant.serverUrl + "/base/deviceInfo/list");
}

function getDeviceRule(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/getDeviceRule", formData);
}

function saveDeviceRule(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/saveDeviceRule", formData);
}
function query(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/query", formData);
}

function reboot(formData) {
  return request.post(constant.serverUrl + "/base/deviceInfo/reboot", formData);
}


export default {
  create, edit, add, update, remove, batchRemove, pageList, getByIpAddressAndPort, list,
  getDeviceRule, saveDeviceRule, query, reboot
}