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

/**
 * UDM鉴权用户重载数据
 * @param neId 网元ID
 * @returns object
 */
export function resetUDMAuth(neId: string) {
  return request({
    url: `/neData/udm/auth/resetData/${neId}`,
    method: 'PUT',
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户列表
 * @param query 查询参数
 * @returns object
 */
export function listUDMAuth(query: Record<string, any>) {
  return request({
    url: '/neData/udm/auth/list',
    method: 'GET',
    params: query,
    timeout: 30_000,
  });
}

/**
 * UDM鉴权用户信息
 * @param neId 网元ID
 * @param imsi IMSI
 * @returns object
 */
export function getUDMAuth(neId: string, imsi: string) {
  return request({
    url: `/neData/udm/auth/${neId}/${imsi}`,
    method: 'GET',
  });
}

/**
 * UDM鉴权用户新增
 * @param data 鉴权对象
 * @returns object
 */
export function addUDMAuth(data: Record<string, any>) {
  return request({
    url: `/neData/udm/auth/${data.neId}`,
    method: 'POST',
    data: data,
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户批量新增
 * @param data 鉴权对象
 * @param num 数量
 * @returns object
 */
export function batchAddUDMAuth(data: Record<string, any>, num: number) {
  return request({
    url: `/neData/udm/auth/${data.neId}/${num}`,
    method: 'POST',
    data: data,
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户修改
 * @param data 鉴权对象
 * @returns object
 */
export function updateUDMAuth(data: Record<string, any>) {
  return request({
    url: `/neData/udm/auth/${data.neId}`,
    method: 'PUT',
    data: data,
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户删除
 * @param neId 网元ID
 * @param imsi IMSI
 * @returns object
 */
export function delUDMAuth(neId: string, imsi: string) {
  return request({
    url: `/neData/udm/auth/${neId}/${imsi}`,
    method: 'DELETE',
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户批量删除
 * @param neId 网元ID
 * @param imsi IMSI
 * @param num 数量
 * @returns object
 */
export function batchDelUDMAuth(neId: string, imsi: string, num: number) {
  return request({
    url: `/neData/udm/auth/${neId}/${imsi}/${num}`,
    method: 'DELETE',
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户导入
 * @param data 表单数据对象
 * @returns object
 */
export function importUDMAuth(data: Record<string, any>) {
  return request({
    url: `/neData/udm/auth/import`,
    method: 'POST',
    data,
    timeout: 180_000,
  });
}

/**
 * UDM鉴权用户导出
 * @param data 数据参数
 * @returns bolb
 */
export function exportUDMAuth(data: Record<string, any>) {
  return request({
    url: '/neData/udm/auth/export',
    method: 'GET',
    params: data,
    responseType: 'blob',
    timeout: 180_000,
  });
}
