"use client";
import { useCallback } from "react";
import { useStigmer } from "../hooks";
import { useResourceList } from "../search";
/**
 * Data hook that fetches a paginated list of workflows for the Workflows section.
 *
 * Wraps `stigmer.workflow.list()` with pagination, scope filtering,
 * and text search. All parameters are externally controlled — the
 * consumer manages page state, query debouncing, and scope toggling.
 *
 * Pass `null` as `org` to skip fetching (stable no-op).
 *
 * @example
 * ```tsx
 * const { workflows, totalCount, isLoading } = useWorkflowList("acme", {
 *   page: 1,
 *   pageSize: 20,
 *   scope: "org",
 * });
 * ```
 */
export function useWorkflowList(org, options) {
    const stigmer = useStigmer();
    const listFn = useCallback((params) => stigmer.workflow.list(params), [stigmer]);
    const { entries, totalCount, totalPages, currentPage, isLoading, error, refetch } = useResourceList(listFn, org, options);
    return { workflows: entries, totalCount, totalPages, currentPage, isLoading, error, refetch };
}
//# sourceMappingURL=useWorkflowList.js.map