import { useCallback, useState, useEffect } from 'react';

export const useDepth3DAnimation = () => {
  const [isAnimating, setIsAnimating] = useState(false);
  const [depth, setDepth] = useState(0);

  const startAnimation = useCallback(() => {
    setIsAnimating(true);
    setDepth(100);
  }, []);

  const stopAnimation = useCallback(() => {
    setIsAnimating(false);
    setDepth(0);
  }, []);

  useEffect(() => {
    if (isAnimating) {
      const timer = setTimeout(() => {
        setIsAnimating(false);
      }, 1000);
      return () => clearTimeout(timer);
    }
  }, [isAnimating]);

  return {
    isAnimating,
    depth,
    startAnimation,
    stopAnimation
  };
};