﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TTF.Models.Tree
{
    /// <summary>
    /// The nodes that compose the tree
    /// </summary>
    public interface ITreeNode
    {
        /// <summary>
        /// Determine if the node is a leaf.
        /// </summary>
        /// <returns></returns>
        bool IsLeaf();
        /// <summary>
        /// Returns the next element in the tree given the input value.
        /// </summary>
        /// <param name="value"></param>
        /// <returns>
        /// If <seealso cref="ITreeNode.IsLeaf"/> returns <code>true</code> this
        /// method should always return <code>null</code>.
        /// 
        /// However, if <seealso cref="ITreeNode.IsLeaf"/> returns <code>false</code>,
        /// this method will return either the next node of the tree or <code>false</code>.
        /// It <code>false</code> is returned, we reached the end of the path and not calculation
        /// has been set.
        /// </returns>
        ITreeNode GetNext(bool value);
        /// <summary>
        /// Calculates the output given the input values.
        /// </summary>
        /// <param name="D"></param>
        /// <param name="E"></param>
        /// <param name="F"></param>
        /// <returns>
        /// If <seealso cref="ITreeNode.IsLeaf"/> returns <code>true</code> this
        /// method will do the calculation. Otherwise, it will throw an 
        /// <seealso cref="InvalidOperationException"/>
        /// </returns>
        TreeCalcResult CalculateOutput(float D, float E, float F);
    }
}
