import type { ComputedRef, MaybeRefOrGetter } from 'vue'
import type { HandleConnection, HandleType } from '../types'

export interface UseNodeConnectionsParams {
  type: MaybeRefOrGetter<HandleType>
  nodeId?: MaybeRefOrGetter<string | null>
  onConnect?: (connections: HandleConnection[]) => void
  onDisconnect?: (connections: HandleConnection[]) => void
}
/**
 * Composable that returns existing connections of a node by handle type.
 * This is useful when you want to get all connections of a node by a specific handle type.
 *
 * @public
 * @param params
 * @param params.type - handle type `source` or `target`
 * @param params.nodeId - node id - if not provided, the node id from the `useNodeId` (meaning, the context-based injection) is used
 * @param params.onConnect - gets called when a connection is created
 * @param params.onDisconnect - gets called when a connection is removed
 *
 * @returns An array of connections
 */
export declare function useNodeConnections(params: UseNodeConnectionsParams): ComputedRef<HandleConnection[]>
