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

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

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

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

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

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

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

/**
 * UDM签约用户删除
 * @param data 签约对象
 * @returns object
 */
export function delUDMSub(neId: string, imsi: string) {
  return request({
    url: `/neData/udm/sub/${neId}/${imsi}`,
    method: 'DELETE',
    timeout: 180_000,
  });
}

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

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

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