'use client';

import { useTourContext } from '../context/TourContext';
import type { UseTourReturn } from '../types';

/**
 * Hook to control the tour.
 * Must be used within a TourProvider.
 */
export function useTour(): UseTourReturn {
  const {
    start,
    next,
    previous,
    goTo,
    close,
    isActive,
    activeTourId,
    currentStep,
    currentStepIndex,
    totalSteps,
    isFirstStep,
    isLastStep,
    progress,
  } = useTourContext();

  return {
    start,
    next,
    previous,
    goTo,
    close,
    isActive,
    activeTourId,
    currentStep,
    currentStepIndex,
    totalSteps,
    isFirstStep,
    isLastStep,
    progress,
  };
}
