import { createContext, useContext } from 'react';

// Main context menu context
const ContextMenuContext = createContext(null);
const useContextMenuContext = () => {
    const context = useContext(ContextMenuContext);
    if (!context) {
        throw new Error("ContextMenu compound components must be used within a ContextMenu component");
    }
    return context;
};
// Submenu context (for nested menus)
const SubMenuContext = createContext(null);
const useSubMenuContext = () => {
    const context = useContext(SubMenuContext);
    if (!context) {
        throw new Error("ContextMenu.Sub compound components must be used within a ContextMenu.Sub component");
    }
    return context;
};

export { ContextMenuContext, SubMenuContext, useContextMenuContext, useSubMenuContext };
