'use client'

// =============================================================================
// TOM Generator Hook
// Custom hook for consuming the TOM Generator context
// =============================================================================

import { useContext } from 'react'
import { TOMGeneratorContext } from './provider'
import type { TOMGeneratorContextValue } from './provider'

export function useTOMGenerator(): TOMGeneratorContextValue {
  const context = useContext(TOMGeneratorContext)
  if (!context) {
    throw new Error(
      'useTOMGenerator must be used within a TOMGeneratorProvider'
    )
  }
  return context
}
