import {TreeNode} from "./TreeNode";
import {BranchNode} from "./StateBranchNode";
import {TestableNode} from "./TestableNode";
import {TreeNodeAnchor} from "./TreeNodeAnchor";
import {GeneralHelpers} from "@xyflow/react";

export type RendererNodeType = TreeNode | BranchNode | TestableNode | TreeNodeAnchor

export interface RendererNodeData {
    /**
     * This is the id of the node that is rendered
     */
    getId(): string,
    leftSpacing?: () => number
    topSpacing?: () => number
    treeNodeForCalculatingFullWidth?: () => (TreeNode | undefined)
    horizontalSourceX?: (getNode: GeneralHelpers['getNode']) => (number | undefined)
}
export interface RendererNode extends RendererNodeData, FirstRenderedNode, LastRenderedNode {
}

export interface FirstRenderedNodeData extends RendererNodeData {
    getTargetRenderNodeId(): string
    // doesn't have a source because it's the first node
}
export interface FirstRenderedNode  {
    getTargetRenderNode(): RendererNodeType | undefined
}
export interface LastRenderedNodeData extends RendererNodeData {
    getSourceRenderNodeId(): string
    // doesn't have a target because it's the last node
}

export interface LastRenderedNode extends LastRenderedNodeData {
    getSourceRenderNode(): RendererNodeType | undefined
}
export interface MiddleRenderedNodeData extends FirstRenderedNodeData, LastRenderedNodeData {}

export interface TreeNodeComponent {
    setTreeNode(treeNode: TreeNode) : void
    getTreeNode(): TreeNode
}