
import { createContext, useContext } from 'react';
import { BudgetContextType } from './types';

// BudgetContext 생성
export const BudgetContext = createContext<BudgetContextType | undefined>(undefined);

// useBudget 훅
export const useBudget = () => {
  const context = useContext(BudgetContext);
  if (context === undefined) {
    throw new Error("useBudget must be used within a BudgetProvider");
  }
  return context;
};

export type { BudgetContextType };
