import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { request } from '@/plugins/http-fetch';
import { parseObjLineToHump } from '@/utils/parse-utils';

/**
 * 查询列表
 * @returns object
 */
export async function listNSSF() {
  const result = await request({
    url: '/api/rest/ueManagement/v1/elementType/nssf/objectType/subscriptions',
    method: 'GET',
  });
  let data = {
    data: { total: 0, rows: [] as any },
    code: result.code,
    msg: result.msg,
  };
  // 解析数据
  if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
    const rows = parseObjLineToHump(result.data.data);
    data.data.total = rows.length;
    data.data.rows = rows;
  }
  return data;
}
