// src/hooks/useMasterItems.tsx
import { useContext } from 'react';
import { MasterItemsContext, MasterItemsContextType } from '../contexts/MasterItemsContext';

export const useMasterItems = (): MasterItemsContextType => {
  const context = useContext(MasterItemsContext);
  if (context === undefined) {
    throw new Error('useMasterItems must be used within a MasterItemsProvider');
  }
  return context;
};