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

/**
 * 查询列表
 * @param query 查询参数
 * @returns object
 */
export async function listN3iwf(query: Record<string, any>) {
  const result = await request({
    url: '/api/rest/ueManagement/v1/elementType/n3iwf/objectType/ueInfo',
    method: 'GET',
    params: query,
  });
  const 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;
  }
  // 模拟数据
  // data.rows = [
  //       {
  //         "activeTime": "2023-11-29 06:35:43",
  //         "imsi": "460302072701181",
  //         "nai": "0460302072701181@nai.epc.mnc030.mcc460.3gppnetwork.org",
  //         "regState": 1
  //     }
  // ]

  return data;
}
