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

/**
 * 查询AMF-UE会话事件列表
 * @param query 查询参数
 * @returns object
 */
export function listAMFDataUE(query: Record<string, any>) {
  return request({
    url: '/neData/amf/ue/list',
    method: 'GET',
    params: query,
    timeout: 60_000,
  });
}

/**
 * AMF-UE会话删除
 * @param id 信息ID
 * @returns object
 */
export function delAMFDataUE(ueIds: string | number) {
  return request({
    url: `/neData/amf/ue/${ueIds}`,
    method: 'DELETE',
    timeout: 60_000,
  });
}

/**
 * AMF-UE会话列表导出
 * @param data 查询列表条件
 * @returns object
 */
export function exportAMFDataUE(data: Record<string, any>) {
  return request({
    url: '/neData/amf/ue/export',
    method: 'POST',
    data,
    responseType: 'blob',
    timeout: 60_000,
  });
}

/**
 * AMF-接入基站信息列表
 * @param query 查询参数 neId=001&id=1
 * @returns object
 */
export function listAMFNblist(query: Record<string, any>) {
  return request({
    url: '/neData/amf/nb/list',
    method: 'GET',
    params: query,
    timeout: 60_000,
  });
}

/**
 * AMF-接入基站状态信息列表
 * @param query 查询参数 neId=001&state=1
 * @returns object
 */
export function listAMFNbStatelist(query: Record<string, any>) {
  return request({
    url: '/neData/amf/nb/list-cfg',
    method: 'GET',
    params: query,
    timeout: 60_000,
  });
}

/**
 * AMF-接入基站状态信息新增
 * @param neId 网元ID
 * @param data 数据 { "index": 1, "name": "Gnb", "address": "192.168.8.1", "position": "Area-B" }
 * @returns object
 */
export function addAMFNbState(neId: string, data: Record<string, any>) {
  return request({
    url: `/ne/config/data`,
    method: 'POST',
    data: {
      neType: 'AMF',
      neId: neId,
      paramName: 'gnbList',
      paramData: data,
      loc: `${data.index}`,
    },
  });
}

/**
 * AMF-接入基站状态信息修改
 * @param neId 网元ID
 * @param data 数据 { "index": 1, "name": "Gnb", "address": "192.168.8.1", "position": "Area-B" }
 * @returns object
 */
export function editAMFNbState(neId: string, data: Record<string, any>) {
  return request({
    url: `/ne/config/data`,
    method: 'PUT',
    data: {
      neType: 'AMF',
      neId: neId,
      paramName: 'gnbList',
      paramData: data,
      loc: `${data.index}`,
    },
  });
}

/**
 * AMF-接入基站状态信息删除
 * @param neId 网元ID
 * @param index 数据index
 * @returns object
 */
export function delAMFNbState(neId: string, index: string | number) {
  return request({
    url: `/ne/config/data`,
    method: 'DELETE',
    params: {
      neType: 'AMF',
      neId: neId,
      paramName: 'gnbList',
      loc: `${index}`,
    },
  });
}
