import { useState } from "react";

/**
 * Custom hook to manage the visibility and render count of a window component.
 * @returns {object} - An object containing the state and functions to manage the window visibility and render count.
 */
export const useWindowShow = () => {
  // State to track if the window is active (visible)
  const [isWindowActive, setIsWindowActive] = useState(false);
  
  // State to track the number of renders
  const [renderCount, setRenderCount] = useState(0);

  /**
   * Function to force the list to re-render by incrementing the render count.
   */
  const forceRenderList = () => {
    setRenderCount((prevCount) => prevCount + 1);
  };

  return { isWindowActive, setIsWindowActive, forceRenderList, renderCount };
};
