import { axios } from '@/utils/request'

const api = {
  equipment: '/meeting/equipment'
}

export function getEquipmentList(parameter) {
  return axios({
    url: api.equipment + '/list',
    method: 'get',
    params: parameter
  })
}

export function get(id) {
  return axios({
    url: api.equipment + '/get/' + id,
    method: 'get',
    params: {}
  })
}

export function getRoomList (parameter) {
  return axios({
    url: api.equipment + '/getRoomList',
    method: 'get',
    params: parameter
  })
}


export function recordByDeviceId(id) {
  return axios({
    url: api.equipment + '/recordByDeviceId/' + id,
    method: 'get',
    params: {}
  })
}

export function getUserList(params) {
  return axios({
    url: api.equipment + '/getUserList',
    method: 'get',
    params: params
  })
}


export function saveEquipment(parameter) {
  return axios({
    url: api.equipment + (parameter.id > 0 ? '/update' : '/save'),
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function delEquipment(parameter) {
  return axios({
    url: api.equipment + '/remove',
    method: 'post',
    params: parameter
  })
}

export function saveDevice(parameter) {
  return axios({
    url: api.equipment + '/saveDevice',
    method: 'post',
    data: parameter,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function getUserListByDeviceId(id) {
  return axios({
    url: api.equipment + '/getUserListByDeviceId/' + id,
    method: 'get',
    params: {}
  })
}

export const equipmentExport = api.equipment + '/export'
