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

/**
 * 查询跟踪任务列表
 * @param query 查询参数
 * @returns object
 */
export function listTaskHLR(query: Record<string, any>) {
  return request({
    url: '/trace/task/hlr/list',
    method: 'get',
    params: query,
  });
}

/**
 * 跟踪任务删除
 * @param ids 任务ID
 * @returns object
 */
export function delTaskHLR(ids: string | number) {
  return request({
    url: `/trace/task/hlr/${ids}`,
    method: 'delete',
    timeout: 60_000,
  });
}

/**
 * 跟踪任务创建
 * @param data 对象
 * @returns object
 */
export function startTaskHLR(data: Record<string, any>) {
  return request({
    url: '/trace/task/hlr/start',
    method: 'post',
    data: data,
    timeout: 60_000,
  });
}

/**
 * 跟踪任务停止
 * @param data 对象
 * @returns object
 */
export function stopTaskHLR(data: Record<string, any>) {
  return request({
    url: '/trace/task/hlr/stop',
    method: 'post',
    data: data,
    timeout: 60_000,
  });
}

/**
 * 跟踪任务文件
 * @param data 对象
 * @returns object
 */
export function fileTaskHLR(data: Record<string, any>) {
  return request({
    url: '/trace/task/hlr/file',
    method: 'post',
    data: data,
  });
}

/**
 * 跟踪任务文件从网元到本地
 * @param query 对象
 * @returns object
 */
export function filePullTaskHLR(query: Record<string, any>) {
  return request({
    url: '/trace/task/hlr/filePull',
    method: 'get',
    params: query,
    responseType: 'blob',
    timeout: 60_000,
  });
}
