/**
 * Combines a future's type and the respective result's type
 */
interface TypeMap {
	arrayBuffer: [ ArrayBufferFuture, ArrayBuffer ];
	measurementScenes: [ MeasurementScenesFuture, MeasurementScene[] ];
	boolean: [ BooleanFuture, boolean ];
	polygon: [ PolygonFuture, Polygon];
	nest3Result: [ Nest3ResultFuture, Array<Nest3ResultBox> ];
	twoDimRepOpt: [ TwoDimRepOptionalFuture, TwoDimRepresentation | undefined ];
}

export function getFutureResult<Type extends keyof TypeMap>(future: TypeMap[Type][0]): TypeMap[Type][1] {
	// Note:  Don't know why this works without type cast even though getFutureResult() returns a sum type.
	// If at some point in the future the compiler requires a type cast, this should be fine though as the API
	// guarantees consistency for the Future and the result's type.
	return wsi4.util.getFutureResult(future);
}
