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

/**
 * 查询网元端文件列表
 * @param query 查询参数
 * @returns object
 */
export function listNeFiles(query: Record<string, any>) {
  return request({
    url: '/ne/action/files',
    method: 'get',
    params: query,
  });
}

/**
 * 从网元到本地获取文件
 * @param query 查询参数
 * @returns object
 */
export function getNeFile(query: Record<string, any>) {
  return request({
    url: '/ne/action/pullFile',
    method: 'get',
    params: query,
    responseType: 'blob',
    timeout: 180_000,
  });
}

// 从网元到本地获取目录压缩为ZIP
export function getNeDirZip(data: Record<string, any>) {
  return request({
    url: '/ne/action/pullDirZip',
    method: 'get',
    params: data,
    responseType: 'blob',
    timeout: 60_000,
  });
}

// 查看网元端文件内容
export function getNeViewFile(data: Record<string, any>) {
  return request({
    url: '/ne/action/viewFile',
    method: 'get',
    params: data,
    timeout: 60_000,
  });
}
