module MultiScaleTreeGraph
using AbstractTrees
using Printf
using DataFrames
import MutableNamedTuples: MutableNamedTuple
using DelimitedFiles
using OrderedCollections
import XLSX: readxlsx, sheetnames
import SHA: sha1 # for naming the cache variable
import Base.setindex!
import DataFrames: transform!, transform # We define our own version for transforming the MTG
import DataFrames: select!, select # We define our own version for transforming the MTG
import DataFrames: rename!, names # We define our own version for renaming node attributes
import MetaGraphsNext: MetaGraph, code_for, add_edge! # Transform to MetaGraph
import Graphs.DiGraph
using RecipesBase # For plotting with Plots.jl backends

include("types/AbstractNodeMTG.jl")
include("types/Node.jl")
include("read_MTG/read_MTG.jl")
include("read_MTG/strip_comments.jl")
include("read_MTG/utils-string.jl")
include("read_MTG/parse_section.jl")
include("read_MTG/parse_mtg.jl")
include("read_MTG/expand_node.jl")
include("compute_MTG/node_funs.jl")
include("print_MTG/print.jl")
include("compute_MTG/caching.jl")
include("compute_MTG/equality.jl")
include("compute_MTG/indexing.jl")
include("compute_MTG/descendants.jl")
include("compute_MTG/ancestors.jl")
include("compute_MTG/check_filters.jl")
include("compute_MTG/mutation.jl")
include("compute_MTG/append_attributes.jl")
include("compute_MTG/traverse.jl")
include("compute_MTG/transform.jl")
include("compute_MTG/select.jl")
include("compute_MTG/delete_nodes.jl")
include("compute_MTG/filter/filter-funs.jl")
include("write_mtg/update_sections.jl")
include("write_mtg/write_mtg.jl")
include("compute_MTG/insert_nodes.jl")
include("compute_MTG/mutation_helpers.jl")
include("compute_MTG/nleaves.jl")
include("compute_MTG/pipe_model.jl")
include("compute_MTG/get_node.jl")
include("conversion/DataFrame.jl")
include("conversion/MetaGraph.jl")
include("plot_MTG/coordinates.jl")
include("plot_MTG/plot.jl")

export read_mtg
export isleaf
export isroot
export children
export addchild!
export traverse!
export traverse
export transform!, transform, select!, select
export get_root
export nextsibling
export print
export show
export length
export DataFrame
export MetaGraph
export iterate
export siblings
export append!
export @mutate_node!
export @mutate_mtg!
export is_filtered
export delete_nodes!
export delete_node!
export insert_parents!, insert_generations!, insert_children!, insert_siblings!
export insert_parent!, insert_generation!, insert_child!, insert_sibling!
export write_mtg
export is_segment!
export descendants, ancestors, descendants!
export Node
export AbstractNodeMTG
export NodeMTG
export MutableNodeMTG
export (==)
export check_filters
export get_features, get_attributes
export list_nodes
export get_classes
export get_description
export clean_cache!
export branching_order!
export nleaves!, nleaves, nleaves_siblings!
export pipe_model!
export get_node
export new_child_link
export new_id, max_id

end
