import { useContext } from 'react';
import { DialogContext } from '../components/Provider/DialogProvider';
import { type IDialogContextValue } from '../interfaces/common';

// 导出useDialog hook
export const useDialog = (): IDialogContextValue => {
  const context = useContext(DialogContext);
  if (!context) {
    throw new Error('useDialog must be used within a DialogProvider');
  }
  return context;
};
