import request from "@/utils/request";

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

// 查询设备分组详细
export function getGroup(groupId) {
  return request({
    url: "/device/group/" + groupId,
    method: "get",
  });
}

// 新增设备分组
export function addGroup(data) {
  return request({
    url: "/device/group",
    method: "post",
    data: data,
  });
}

// 修改设备分组
export function updateGroup(data) {
  return request({
    url: "/device/group",
    method: "put",
    data: data,
  });
}

// 删除设备分组
export function delGroup(groupId) {
  return request({
    url: "/device/group/" + groupId,
    method: "delete",
  });
}

// 分配设备
export function assignDevice(groupId, deviceIds) {
  return request({
    url: `/device/group/allot/${groupId}/${deviceIds}`,
    method: "post",
  });
}

// 分配设备
export function unAssignDevice(deviceIds) {
  return request({
    url: `/device/group/deleteAllot/${deviceIds}`,
    method: "delete",
  });
}
