import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: request.apiModule.rdfm + '/repository',
    method: 'get',
    params: query
  })
}

export function createKnoBase(data) {
  return request({
    url: request.apiModule.rdfm + '/repository/manager',
    method: 'post',
    data
  })
}

export function updateKnoBase(data) {
  return request({
    url: request.apiModule.rdfm + '/repository',
    method: 'put',
    data
  })
}

export function deleteNode(id) {
  return request({
    url: request.apiModule.rdfm + '/repository',
    method: 'delete',
    data: { id: id }
  })
}

//上下移
export function moveNode(data) {
  return request({
    url: request.apiModule.rdfm + '/repository/move',
    method: 'put',
    data
  })
}
//获取关联对象树
export function getObjTree() {
  return request({
    url: request.apiModule.rdfm + '/repository/object',
    method: 'get'
  })
}
//粘贴操作
export function pasteNode(data) {
  return request({
    url: request.apiModule.rdfm + '/repository/paste',
    method: 'put',
    data
  })
}
//获取顶层结构列表
export function getStru(query) {
  return request({
    url: request.apiModule.rdfm + '/repository/structure',
    method: 'get',
    params: query
  })
}

//新增知识库节点信息
export function addNode(data) {
  return request({
    url: request.apiModule.rdfm + '/repository/structure',
    method: 'post',
    data
  })
}

//获取结构树
export function getFailTree(query) {
  return request({
    url: request.apiModule.rdfm + '/repository/tree',
    method: 'get',
    params: query
  })
}
//转换节点类型
export function changeNode(id) {
  return request({
    url: request.apiModule.rdfm + '/repository/type',
    method: 'put',
    data: { id: id }
  })
}
//双击节点改名
export function changeName(data) {
  return request({
    url: request.apiModule.rdfm + '/repository/name',
    method: 'put',
    data: data
  })
}
