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

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

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

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

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

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

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

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

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