// components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts
import { useEffect, useState } from "react";

const useLoopDisplay = (
  schleifenwiderstand: number,
  activeButton: "Schleife" | "TDR" | "ISO"
) => {
  const [loopDisplayValue, setLoopDisplayValue] =
    useState<number>(schleifenwiderstand);

  useEffect(() => {
    if (activeButton === "Schleife") {
      setLoopDisplayValue(schleifenwiderstand);
    }
    // For ISO and TDR, the value is set manually via setLoopDisplayValue
  }, [schleifenwiderstand, activeButton]);

  return { loopDisplayValue, setLoopDisplayValue };
};

export default useLoopDisplay;
