import {
	Costs,
} from "qrc:/js/lib/calc_costs";
import {
	Times,
} from "qrc:/js/lib/calc_times";

interface SheetShareEntry {
	article: readonly Readonly<Vertex>[];
	relShareSheetSource: number|undefined;
}

interface SheetTargetAreaEntry {
	sheetVertex: Vertex;
	area: number|undefined;
}

interface CacheNodeTimesEntry {
	vertex: Vertex,
	multOneTimes: Times,
}

interface CacheNodeCostsEntry {
	vertex: Vertex,
	multOneCosts: Costs|undefined,
}

export interface CalcCache {
	sheetShareEntries: SheetShareEntry[];
	sheetTargetAreaEntries: SheetTargetAreaEntry[],
	nodeTimesEntries: CacheNodeTimesEntry[];
	nodeCostsEntries: CacheNodeCostsEntry[];
	dieSharingPartitions: Vertex[][]|undefined;
}

/**
 * Factory function that initializes a new cache
 *
 * This function should be utilized to initialize the cache.
 * This ensures that the call site remains independent from the cache implementation.
 */
export function createCalcCache(): CalcCache {
	return {
		sheetShareEntries: [],
		sheetTargetAreaEntries: [],
		nodeTimesEntries: [],
		nodeCostsEntries: [],
		dieSharingPartitions: undefined,
	};
}

