import request from '../index'
const prefix = 'device/group'

// 查询分组列表 分页
export function getGroupListPage(data: any) {
  return request({
    url: `${prefix}/list-page?limit=${data.limit}&offset=${data.offset}`,
    method: 'post',
    data,
  })
}
// 查询分组列表 不分页
export function getGroupList(data: object) {
  return request({
    url: `${prefix}/list`,
    method: 'post',
    data,
  })
}
// 查询分组详情
export function detailGroup(data: object) {
  return request({
    url: `${prefix}/detail`,
    method: 'post',
    data,
  })
}
// 资源树列表
export function getResourceTreeList() {
  return request({
    url: `${prefix}/resource/tree`,
    method: 'get',
  })
}

// 资源类型列表
export function getResourceTypeList() {
  return request({
    url: `${prefix}/dict/code/resourceType`,
    method: 'get',
  })
}

// 添加分组
export function addGroup(data: object) {
  return request({
    url: `${prefix}/add`,
    method: 'post',
    data,
  })
}
// 修改分组
export function updateGroup(data: object) {
  return request({
    url: `${prefix}/update`,
    method: 'post',
    data,
  })
}
// 删除分组
export function delGroup(id: string) {
  return request({
    url: `${prefix}/delete`,
    method: 'post',
    data: {
      ids: [id],
    },
  })
}
