'use client';

import { createContext, useContext } from 'react';
import type { TourState, TourStep, UseTourReturn } from '../types';

export interface TourContextValue extends UseTourReturn {
  state: TourState;
  steps: TourStep[];
}

export const TourContext = createContext<TourContextValue | null>(null);

export function useTourContext(): TourContextValue {
  const context = useContext(TourContext);
  if (!context) {
    throw new Error('useTourContext must be used within a TourProvider');
  }
  return context;
}
