import {LastRenderedNode, RendererNodeData, RendererNodeType} from "./RendererNodeData";
import {TreeNode} from "./TreeNode";
import {Grove} from "./Grove";

export class AddTierButton implements RendererNodeData, LastRenderedNode {
    constructor(
        private readonly id: string,
        private readonly sourceRenderNode: TreeNode,
        private readonly grove: Grove
    ) {
    }
    getId(): string {
        return this.id;
    }
    getSourceRenderNode(): RendererNodeType | undefined {
        return this.grove.get<TreeNode>(this.sourceRenderNode.branchNode.getLastChildId());
    }
    getSourceRenderNodeId(): string {
        return this.getSourceRenderNode()?.getId() || '';
    }

}