import { Ref } from "vue"; /** * Representation of a tree node in the SmartTreeAdapter. */ export type TreeNode = { id: string; data: T; }; /** * Representation of children result from a tree node when there will be a loading state. */ export type ChildrenResult = { status: "loading"; } | { status: "loaded"; data: Array>; }; /** * A tree adapter that can be used with the SmartTree component. * @template T The type of data that is stored in the tree. */ export interface SmartTreeAdapter { /** * * @param nodeID - id of the node to get children for * @param nodeType - Type of the node (`collection` | `request`) * @returns - Ref that contains the children of the node. It is reactive and will be updated when the children are changed. */ getChildren: (nodeID: string | null, nodeType?: string) => Ref>; }