import { useMemo } from "react";
import {
	type CandidateDelta,
	type CandidateInput,
	computeImpactDeltas,
	type DeltaMode,
	type ImpactDeltas,
	type SetupItemInput,
} from "../lib/impactDeltas";

export type { CandidateDelta, DeltaMode, ImpactDeltas };

export function useImpactDeltas(
	candidates: CandidateInput[],
	setupItems: SetupItemInput[] | undefined,
	threadCategoryId: number,
): ImpactDeltas {
	return useMemo(
		() => computeImpactDeltas(candidates, setupItems, threadCategoryId),
		[candidates, setupItems, threadCategoryId],
	);
}
