/*
 * @Author: donghao donghao@supervision.ltd
 * @Date: 2024-02-22 13:38:04
 * @LastEditors: donghao donghao@supervision.ltd
 * @LastEditTime: 2024-03-20 16:51:18
 * @FilePath: \General-AI-Platform-Web-Client\mock\pools\alarmData.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { generateRandomDateTimeByYear } from "../utils/mockMoment";

function fetchSceneItemsList(args = { maxCount: 24 }): Record<string, any>[] {
  const { maxCount } = args;
  const currList: Record<string, any>[] = [];

  const productTypeArr = ["工件9501", "工件1132", "工件2108", "工件9183"];

  for (let i = 0; i < maxCount; i++) {
    currList.push({
      id: 10000 + i,
      alarmNo: 24031215050 + (i + 1), // 序号
      defectType: "表面裂纹", // 缺陷类型
      createTime: generateRandomDateTimeByYear(2024),
      updateTime: "2023-10-17T02:35:41.14308Z", // 检测时间
      productType:
        productTypeArr[Math.floor(Math.random() * productTypeArr.length)], //产品类型
      productL: "15.8mm", // 长
      productW: "15.8mm" // 宽
      // baseInfo: {
      //   left: 397.0215, // 相对x
      //   top: 444.5797 // 相对y
      // }
    });
  }
  return currList;
}

function fetchList(): Record<string, any>[] {
  const currList: Record<string, any>[] = [];
  for (let i = 0; i < 2; i++) {
    currList.push({
      id: 1 + i,
      createTime: generateRandomDateTimeByYear(2023),
      updateTime: "2023-10-17T02:35:41.14308Z",
      name: "GigEPRO_gmcam_01_00" + (i + 1),
      alarmList: fetchSceneItemsList({ maxCount: 4 })
    });
  }
  return currList;
}

export const deviceSceneListData = {
  data: fetchList()
};

export const deviceSceneItemsData = {
  data: {
    list: fetchSceneItemsList(),
    total: fetchSceneItemsList().length,
    page: 1,
    pageSize: 10
  }
};