/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { FilterContext } from "../FilterProvider.js";
import { useContext } from "react";

//#region src/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.ts
/**
* Copyright IBM Corp. 2023, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
const useFilterContext = () => {
	const context = useContext(FilterContext);
	if (Object.entries(context).length === 0) throw new Error("useFilterContext was used outside of its Provider");
	return context;
};

//#endregion
export { useFilterContext as default };