import { type RowSelectionState, type Table } from "@tanstack/react-table";
import type { SearchResult } from "@stigmer/protos/ai/stigmer/search/v1/io_pb";
import type { ListParams, ListResult } from "@stigmer/sdk";
import type { WorkbenchColumnDef, SortValue } from "../types";
/** Options for {@link useResourceCollection}. */
export interface UseResourceCollectionOptions<TData = SearchResult> {
    /**
     * Async function that fetches a page of resources.
     * The hook passes `ListParams` (org, query, page, scope) and expects
     * `ListResult` back. Pass `null` to disable fetching (idle state).
     */
    readonly listFn: ((params: ListParams) => Promise<ListResult>) | null;
    /** Organization slug to scope the query. Pass `null` to disable fetching. */
    readonly org: string | null;
    /** Text search query. No debouncing is applied — the consumer controls timing. */
    readonly query?: string;
    /**
     * Scope for resource visibility.
     * - `"org"` — resources owned by the active organization.
     * - `"all"` — includes public resources from other organizations.
     * @default "org"
     */
    readonly scope?: "org" | "all";
    /** Current page number (1-indexed). @default 1 */
    readonly page?: number;
    /** Page size. @default 20 */
    readonly pageSize?: number;
    /** Active sort. When provided, the column header shows the sort indicator. */
    readonly sort?: SortValue | null;
    /** Called when the user changes the sort via a column header click. */
    readonly onSortChange?: (sort: SortValue | null) => void;
    /**
     * Column definitions for the table view. These are converted to
     * TanStack Table column defs internally.
     */
    readonly columns?: readonly WorkbenchColumnDef<TData>[];
    /** Enable row selection state tracking. @default false */
    readonly enableSelection?: boolean;
}
/** Return value of {@link useResourceCollection}. */
export interface UseResourceCollectionReturn<TData = SearchResult> {
    /** The fetched data items for the current page. */
    readonly items: readonly TData[];
    /** Total number of matching items across all pages. */
    readonly totalCount: number;
    /** Total number of pages. */
    readonly totalPages: number;
    /** The current page number (mirrors input). */
    readonly currentPage: number;
    /** `true` during the initial data fetch (no data yet). */
    readonly isLoading: boolean;
    /** `true` during a background refetch while stale data is shown. */
    readonly isRefetching: boolean;
    /** Error from the last failed fetch, or `null`. */
    readonly error: Error | null;
    /** Imperatively trigger a refetch. */
    readonly refetch: () => void;
    /**
     * The TanStack Table instance. Available for advanced consumers who
     * need direct table API access (e.g. custom renderers). `null` when
     * no columns are provided.
     */
    readonly table: Table<TData> | null;
    /** Current row selection state (item ID -> selected). */
    readonly rowSelection: RowSelectionState;
    /** Update row selection state directly. */
    readonly setRowSelection: React.Dispatch<React.SetStateAction<RowSelectionState>>;
}
/**
 * Headless hook that manages resource collection state: data fetching,
 * sorting, selection, and pagination.
 *
 * Wraps `useFetch` for data and `@tanstack/react-table` for table state
 * (sorting, selection, column visibility). The hook itself produces no
 * DOM — it returns data, state, and a TanStack Table instance that view
 * components (`ResourceTable`, `ResourceCards`, `ResourceList`) consume.
 *
 * Platform builders who want full rendering control use this hook
 * directly. The `ResourceWorkbench` shell composes it internally.
 *
 * @example
 * ```tsx
 * const collection = useResourceCollection({
 *   listFn: (params) => stigmer.agent.list(params),
 *   org: "acme",
 *   query: debouncedQuery,
 *   page: 1,
 *   columns: agentColumns,
 * });
 * ```
 */
export declare function useResourceCollection<TData = SearchResult>(options: UseResourceCollectionOptions<TData>): UseResourceCollectionReturn<TData>;
//# sourceMappingURL=useResourceCollection.d.ts.map