export default function useForgeHeatmap(){

  const createHeatMap = async (heatMapName) => {
    const {
      SurfaceShadingData,
      SurfaceShadingPoint,
      SurfaceShadingNode,
      SurfaceShadingGroup,
    } = Autodesk.DataVisualization.Core;
    const shadingGroup = new SurfaceShadingGroup(`iot_heatmap_${heatMapName}`);
    const rooms = new Map();

    for (const { id, roomDbId, position, sensorTypes } of deviceList.value) {
      if (!id || roomDbId == -1 || !roomDbId) {
        continue;
      }

      if (!rooms.has(roomDbId)) {
        const room = new SurfaceShadingNode(id, roomDbId);
        shadingGroup.addChild(room);
        rooms.set(roomDbId, room);
      }
      const room = rooms.get(roomDbId);
      room.addPoint(new SurfaceShadingPoint(id, position, sensorTypes));
    }

    const shadingData = new SurfaceShadingData();
    shadingData.addChild(shadingGroup);
    shadingData.initialize(forgeViewer.value?.model);

    await dataVizExtension.value.setupSurfaceShading(
      forgeViewer.value.model,
      shadingData
    );
    dataVizExtension.value.registerSurfaceShadingColors(
      "temperature",
      [0x0000ff, 0x00ff00, 0xffff00, 0xff0000]
    );
    dataVizExtension.value.renderSurfaceShading(
      `iot_heatmap_${heatMapName}`,
      "temperature",
      getSensorValue
    );

    console.log(dataVizExtension.value);
  };
}