import { request } from '@/plugins/http-fetch';

/**
 * 查询网元主机列表
 * @param query 查询参数
 * @returns object
 */
export function listNeHost(query: Record<string, any>) {
  return request({
    url: '/ne/host/list',
    method: 'GET',
    params: query,
  });
}

/**
 * 查询网元主机详细
 * @param hostId 网元主机ID
 * @returns object
 */
export function getNeHost(hostId: string | number) {
  return request({
    url: `/ne/host/${hostId}`,
    method: 'GET',
  });
}

/**
 * 新增网元主机
 * @param data 网元主机对象
 * @returns object
 */
export function addNeHost(data: Record<string, any>) {
  return request({
    url: '/ne/host',
    method: 'POST',
    data: data,
  });
}

/**
 * 修改网元主机
 * @param data 网元主机对象
 * @returns object
 */
export function updateNeHost(data: Record<string, any>) {
  return request({
    url: '/ne/host',
    method: 'PUT',
    data: data,
  });
}

/**
 * 删除网元主机
 * @param hostId 网元主机ID
 * @returns object
 */
export function delNeHost(hostId: string | number) {
  return request({
    url: `/ne/host/${hostId}`,
    method: 'DELETE',
  });
}

/**
 * 测试连接网元主机
 * @param data 网元主机对象
 * @returns object
 */
export function testNeHost(data: Record<string, any>) {
  return request({
    url: '/ne/host/test',
    method: 'POST',
    data: data,
  });
}

/**
 * 网元主机SSH方式检查服务器环境
 * @param data 网元主机对象
 * @returns object
 */
export function neHostCheckInfo(data: Record<string, any>) {
  return request({
    url: '/ne/host/checkBySSH',
    method: 'POST',
    data: data,
  });
}

/**
 * 网元主机SSH方式授权免密发送
 * @param data 网元主机对象
 * @returns object
 */
export function neHostAuthorizedRSA(data: Record<string, any>) {
  return request({
    url: '/ne/host/authorizedBySSH',
    method: 'POST',
    data: data,
  });
}
