import request from '@/utils/request'

/**     --------------资源管理---------------     */
// 查询资源注册列表
export function listHandle(query) {
  return request({
    url: '/system/registration/list',
    method: 'post',
    data: query
  })
}
// 资源全部list
export function listAllResourList(data) {
  return request({
    url: '/system/registration/selectAllResourceNameByType',
    method: 'post',
    data: data
  })
}

// 查询资源注册详细
export function getHandle(Id) {
  return request({
    url: '/system/registration/' + Id,
    method: 'get'
  })
}

// 新增资源注册
export function addHandle(data) {
  return request({
    url: '/system/registration',
    method: 'post',
    data: data
  })
}

// 修改资源注册
export function updateHandle(data) {
  return request({
    url: '/system/registration',
    method: 'put',
    data: data
  })
}
// 修改注册状态
export function updateregisterType(data) {
  return request({
    url: '/system/registration/register',
    method: 'post',
    data: data
  })
}
// 交换机/服务器--节点名称查询
export function resNameBtType(data) {
  return request({
    url: '/system/registration/selectAllResourceNameByType',
    method: 'post',
    data: data
  })
}


/**   ----------------拓扑管理 ------------    */
// 查询列表
export function listTopology(query) {
  return request({
    url: '/system/management/list',
    method: 'post',
    data: query
  })
}
// 查询all列表
export function listAllTopology(query) {
  return request({
    url: '/system/management/getListChart',
    method: 'post',
    data: query
  })
}

// 查询资源注册详细
export function getTopology(Id) {
  return request({
    url: '/system/management/' + Id,
    method: 'get'
  })
}

// 新增资源注册
export function addTopology(data) {
  return request({
    url: '/system/management',
    method: 'post',
    data: data
  })
}

// 修改资源注册
export function updateTopology(data) {
  return request({
    url: '/system/management',
    method: 'put',
    data: data
  })
}
// 删除
export function delTopology(Ids) {
  return request({
    url: '/system/management/' + Ids,
    method: 'delete'
  })
}
// 服务器网口
export function postInterFaceName(data) {
  return request({
    url: '/system/interfaceName/getAllNames',
    method: 'post',
    data: data
  })
}

/**   ----------------资源分组------------    */
// 查询列表
export function listGroup(query) {
  return request({
    url: '/system/group/list',
    method: 'post',
    data: query
  })
}
// 查询详细
export function getGroup(Id) {
  return request({
    url: '/system/group/' + Id,
    method: 'get'
  })
}

// 新增
export function addGroup(data) {
  return request({
    url: '/system/group',
    method: 'post',
    data: data
  })
}

// 修改
export function updateGroup(data) {
  return request({
    url: '/system/group',
    method: 'put',
    data: data
  })
}
// 删除
export function delGroup(Ids) {
  return request({
    url: '/system/group/' + Ids,
    method: 'delete'
  })
}
// 包含设备向右移动校验
export function exitsResourceById(data) {
  return request({
    url: '/system/group/exitsResourceById',
    method: 'post',
    data: data
  })
}
// 包含设备查询
export function resNameList() {
  return request({
    url: '/system/registration/selectAllResourceName',
    method: 'get'
  })
}
/**   ----------------监控模版管理------------    */
// 查询列表
export function listMonitorTemp(query) {
  return request({
    url: '/rocketmq/template/list',
    method: 'post',
    data: query
  })
}
// 查询详细
export function getMonitorTemp(Id) {
  return request({
    url: '/rocketmq/template/' + Id,
    method: 'get'
  })
}
// 查询资源监控项
export function getMonitorTempList(query) {
  return request({
    url: '/rocketmq/initialMonitorItem/list',
    method: 'post',
    data: query
  })
}

// 新增
export function addMonitorTemp(data) {
  return request({
    url: '/rocketmq/template',
    method: 'post',
    data: data
  })
}

// 修改
export function updateMonitorTemp(data) {
  return request({
    url: '/rocketmq/template',
    method: 'put',
    data: data
  })
}
// 删除
export function delMonitorTemp(Ids) {
  return request({
    url: '/rocketmq/template/' + Ids,
    method: 'delete'
  })
}

/**   ----------------资源监控策略------------    */
// 查询列表
export function listMonitorPolicy(query) {
  return request({
    url: '/rocketmq/monitorPolicy/list',
    method: 'post',
    data: query
  })
}
// 查询详细
export function getMonitorPolicy(Id) {
  return request({
    url: '/rocketmq/monitorPolicy/' + Id,
    method: 'get'
  })
}
// 下发策略
export function getMonitorPolicyList(Id) {
  return request({
    url: '/rocketmq/monitorPolicy/issuePolicy?id=' + Id,
    method: 'get'
  })
}

// 新增
export function addMonitorPolicy(data) {
  return request({
    url: '/rocketmq/monitorPolicy',
    method: 'post',
    data: data
  })
}

// 修改
export function updateMonitorPolicy(data) {
  return request({
    url: '/rocketmq/monitorPolicy',
    method: 'put',
    data: data
  })
}
// 删除
export function delMonitorPolicy(Ids) {
  return request({
    url: '/rocketmq/monitorPolicy/' + Ids,
    method: 'delete'
  })
}
// 关联监控模板下拉接口
export function getMonitorPolicyTemp() {
  return request({
    url: '/rocketmq/template/getAllTemplate',
    method: 'get'
  })
}
// 关联资源组下拉接口
export function getResMonitorGroup() {
  return request({
    url: '/system/resourceMonitor/resourceGroupList ',
    method: 'get'
  })
}
/**   ----------------脚本服务器策略------------    */
// 查询列表
export function listPolicy(query) {
  return request({
    url: '/rocketmq/policy/list',
    method: 'post',
    data: query
  })
}
// 查询详细
export function getPolicy(Id) {
  return request({
    url: '/rocketmq/policy/' + Id,
    method: 'get'
  })
}
// 下发策略
export function getPolicyList(Id) {
  return request({
    url: '/rocketmq/policy/issueDeploymentPolicy?id=' + Id,
    method: 'get'
  })
}

// 新增
export function addPolicy(data) {
  return request({
    url: '/rocketmq/policy',
    method: 'post',
    data: data
  })
}

// 修改
export function updatePolicy(data) {
  return request({
    url: '/rocketmq/policy',
    method: 'put',
    data: data
  })
}
// 删除
export function delPolicy(Ids) {
  return request({
    url: '/rocketmq/policy/' + Ids,
    method: 'delete'
  })
}
/**   ----------------脚本执行结果------------    */
export function getScriptResultBySn(data) {
  return request({
    url: '/rocketmq/remote/getScriptResultBySn',
    method: 'post',
    data: data
  })
}
//  获取资源分组列表
export function getResGroupList() {
  return request({
    url: '/system/resourceMonitor/resourceGroupList',
    method: 'get'
  })
}
// 传参 分页参数和 资源组id
export function listRegisterList(data) {
  return request({
    url: '/system/resourceMonitor/getRegisterListByGroupId',
    method: 'post',
    data: data
  })
}
// 通过资源查包含设备
export function listArrRegisterList(data) {
  return request({
    url: '/system/resourceMonitor/getAllRegisterListByGroupId',
    method: 'post',
    data: data
  })
}
/**   ----------------AGENT更新------------    */
// 查询列表
export function listAgentManage(query) {
  return request({
    url: '/rocketmq/agentManagement/list',
    method: 'post',
    data: query
  })
}
// 查询详细
export function getAgentManage(Id) {
  return request({
    url: '/rocketmq/agentManagement/' + Id,
    method: 'get'
  })
}

// 新增
export function addAgentManage(data) {
  return request({
    url: '/rocketmq/agentManagement',
    method: 'post',
    data: data
  })
}

// 修改
export function updateAgentManage(data) {
  return request({
    url: '/rocketmq/agentManagement',
    method: 'put',
    data: data
  })
}
// 删除
export function delAgentManage(Ids) {
  return request({
    url: '/rocketmq/agentManagement/' + Ids,
    method: 'delete'
  })
}
