import service from '@/utils/request'

export const queryAllDevices = () => {
  return service({
    url: '/device/queryAllDevices',
    method: 'get'
  })
}

export const queryDeviceList = (data) => {
  return service({
    url: '/device/queryDeviceList',
    method: 'post',
    data
  })
}

export const generateDeviceFile = (id) => {
  return service({
    url: `/device/generateDeviceFile?id=${id}`,
    method: 'get',
  })
}

export const deviceSwitch = (data) => {
  return service({
    url: '/device/deviceSwitch',
    method: 'post',
    data
  })
}

export const createDevice = (data) => {
  return service({
    url: '/device/createDevice',
    method: 'post',
    data
  })
}

export const updateDevice = (data) => {
  return service({
    url: '/device/updateDevice',
    method: 'put',
    data
  })
}

export const deleteDevice = (id) => {
  return service({
    url: `/device/deleteDevice?id=${id}`,
    method: 'delete'
  })
}

export const queryAllDeviceGenres = () => {
  return service({
    url: '/deviceGenre/queryAllDeviceGenres',
    method: 'get'
  })
}

export const createDeviceGenre = (data) => {
  return service({
    url: '/deviceGenre/createDeviceGenre',
    method: 'post',
    data
  })
}

export const updateDeviceGenre = (data) => {
  return service({
    url: '/deviceGenre/updateDeviceGenre',
    method: 'put',
    data
  })
}

export const deleteDeviceGenre = (id) => {
  return service({
    url: `/deviceGenre/deleteDeviceGenre?id=${id}`,
    method: 'delete'
  })
}
