import { type ReactElement, type ReactNode } from "react";
import type { Collection } from "../db/collection/Collection.js";
import type { DBProvider } from "../db/provider/DBProvider.js";
import type { ItemStore } from "../db/store/ItemStore.js";
import type { QueryStore } from "../db/store/QueryStore.js";
import type { Data } from "../util/data.js";
import type { Identifier, Item } from "../util/item.js";
import type { Nullish } from "../util/null.js";
import type { Query } from "../util/query.js";
export interface DBContext<I extends Identifier, T extends Data> {
    /** Get an `ItemStore` for the specified collection item in the current `DataProvider` context and subscribe to any changes in it. */
    useItem<II extends I, TT extends T>(collection: Nullish<Collection<string, II, TT>>, //
    id: Nullish<II>): ItemStore<II, TT> | undefined;
    useItem<II extends I, TT extends T>(collection: Collection<string, II, TT>, //
    id: II): ItemStore<II, TT>;
    /** Get an `QueryStore` for the specified collection query in the current `DataProvider` context and subscribe to any changes in it. */
    useQuery<II extends I, TT extends T>(collection: Nullish<Collection<string, II, TT>>, //
    query: Nullish<Query<Item<II, TT>>>): QueryStore<II, TT> | undefined;
    useQuery<II extends I, TT extends T>(collection: Collection<string, II, TT>, //
    query: Query<Item<II, TT>>): QueryStore<II, TT>;
    /** The `<DataContext>` wrapper to give your React components access to this data. */
    readonly DBContext: ({ children }: {
        children: ReactNode;
    }) => ReactElement;
}
/**
 * Create a data context
 * - Allows React elements to call `useItem()` and `useQuery()` to access items/queries in a database provider.
 * - If the database has a `CacheDBProvider` in its chain then in-memory data will be used in the returned stores.
 */
export declare function createDBContext<I extends Identifier, T extends Data>(provider: DBProvider<I, T>): DBContext<I, T>;
