import request from "@/utils/request";

// 查询设备列表
export function listDevice(query) {
  return request({
    url: "/iot/device/list",
    method: "get",
    params: query
  });
}

// 查询设备列表
export function myListDevice(query) {
  return request({
    url: "/iot/device/list",
    method: "get",
    params: query
  });
}


// 查询设备详细
export function getDevice(deviceId) {
  return request({
    url: "/iot/device/" + deviceId,
    method: "get"
  });
}

// 新增设备
export function addDevice(data) {
  return request({
    url: "/iot/device",
    method: "post",
    data: data
  });
}

// 修改设备
export function updateDevice(data) {
  return request({
    url: "/iot/device",
    method: "put",
    data: data
  });
}

// 删除设备
export function delDevice(deviceId) {
  return request({
    url: "/iot/device/" + deviceId,
    method: "delete"
  });
}

// 导出设备
export function exportDevice(query) {
  return request({
    url: "/iot/device/export",
    method: "get",
    params: query
  });
}

// 获取设备类型列表
export function listDeviceTypeList(query) {
  return request({
    url: "/iot/device/type-list",
    method: "get",
    params: query
  });
}

// 获取设备日志
export function listDeviceLogList(query) {
  return request({
    url: "/iot/device/log-list",
    method: "get",
    params: query
  });
}

// 获取设备类型列表
export function getDeviceFunList(query) {
  return request({
    url: "/iot/dev/prod/fun/list",
    method: "get",
    params: query
  });
}

// 获取设备类型列表
export function getDeviceCmdList(query) {
  return request({
    url: "/iot/dev/prod/cmd/list",
    method: "get",
    params: query
  });
}

// 设备上报数据单字段查询
export function getDataUploadListAt(data) {
  return request({
    url: "/iot/dev/opt/upload/field/list",
    method: "post",
    data: data
  });
}

// 修改设备密码
export function resetPssword(data) {
  return request({
    url: "/iot/device/reset-password",
    method: "put",
    data: data
  });
}

// 开关控制
export function setSwitchControl(data) {
  return request({
    url: "/iot/dev/opt/down",
    method: "post",
    data: data
  });
}
