import { createContext, useContext } from 'react';

const WorkflowContext = createContext(null);

export function WorkflowProvider({ value, children }) {
  return <WorkflowContext.Provider value={value}>{children}</WorkflowContext.Provider>;
}

export function useWorkflow() {
  const context = useContext(WorkflowContext);

  if (!context) {
    throw new Error('useWorkflow must be used inside WorkflowProvider');
  }

  return context;
}
