export function getDuplicateIdempotencyKey(
  keys: Map<string, string>,
  dealId: string,
  create: () => string = () => crypto.randomUUID(),
): string {
  const existing = keys.get(dealId);
  if (existing) return existing;
  const key = create();
  keys.set(dealId, key);
  return key;
}
