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

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

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

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

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

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

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

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

function isUnbindDeviceList(formData) {
  return request.post(constant.serverUrl + "/personDeviceRelation/isUnbindDeviceList", formData);
}

function batchBindDevice(formData) {
  //多设备绑定人
  return request.post(constant.serverUrl + "/personDeviceRelation/batchBindDevice", formData);
}

function batchBindPerson(formData){
  //多人员绑定设备
  return request.post(constant.serverUrl + "/personDeviceRelation/batchBindPerson", formData);
}

function unbindDevice(formData) {
  return request.post(constant.serverUrl + "/personDeviceRelation/unbindDevice", formData);
}



export default {
  create, edit, add, update, remove, batchRemove, pageList, isUnbindDeviceList, batchBindDevice, unbindDevice,batchBindPerson
}