package main.java.recursive;

import java.util.ArrayList;
import java.util.List;

public class TreeNode {

    private final int id;

    private final int parentId;

    private final String name;

    private final List<TreeNode> children;

    public TreeNode(int id, int parentId, String name) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        children = new ArrayList<>();
    }

    public void addChild(TreeNode child) {
        children.add(child);
    }

    public int getId() {
        return id;
    }

    public int getParentId() {
        return parentId;
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "id=" + id +
                ", parentId=" + parentId +
                ", children=" + children.toString() +
                '}';
    }
}
