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

/**
 * 信令跟踪网卡设备列表
 * @returns
 */
export function packetDevices() {
  return request({
    url: '/trace/packet/devices',
    method: 'get',
  });
}

/**
 * 信令跟踪开始
 * @param data 对象
 * @returns
 */
export function packetStart(data: Record<string, any>) {
  return request({
    url: '/trace/packet/start',
    method: 'post',
    data: data,
  });
}

/**
 * 信令跟踪结束
 * @param data 对象
 * @returns
 */
export function packetStop(taskNo: string) {
  return request({
    url: '/trace/packet/stop',
    method: 'post',
    data: { taskNo },
  });
}

/**
 * 信令跟踪过滤
 * @param data 对象
 * @returns
 */
export function packetFilter(taskNo: string, expr: string) {
  return request({
    url: '/trace/packet/filter',
    method: 'put',
    data: { taskNo, expr },
  });
}

/**
 * 信令跟踪续期保活
 * @param data 对象
 * @returns
 */
export function packetKeep(taskNo: string, duration: number = 120) {
  return request({
    url: '/trace/packet/keep-alive',
    method: 'put',
    data: { taskNo, duration },
  });
}
