import { useContext } from 'react';
import { DraftCtx, type DraftContextValue } from '@/components/applicant/initiative-draft/DraftContext';

export function useDraft(): DraftContextValue {
  const ctx = useContext(DraftCtx);
  if (!ctx) throw new Error('useDraft must be used inside <DraftProvider>');
  return ctx;
}

export function useOptionalDraft(): DraftContextValue | null {
  return useContext(DraftCtx);
}
