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 listNSSFAMF() {
  const result = await request({
    url: '/api/rest/ueManagement/v1/elementType/nssf/objectType/availableAMFs',
    method: 'get',
  });
  let data: DataList = {
    total: 0,
    rows: [],
    code: result.code,
    msg: result.msg,
  };
  // 解析数据
  if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
    const rows = parseObjLineToHump(result.data.data);
    data.total = rows.length;
    data.rows = rows;
  }

  // let testData = {
  //   total:0,
  //   rows: [
  //     {
  //       nfId: '001',
  //       amfSetId: '001',
  //     },
  //     {
  //       nfId: '002',
  //       amfSetId: '[001,002]',
  //     },
  //   ],
  //   code: 1,
  //   msg:'',
  // };
 //return testData;
  return data;
}
