using System;
using System.Collections.Generic;
using System.Drawing;

namespace Toolbox.Docking.Api.Objects.Profiler
{
    /// <summary>
    /// Profiler category node definition.
    /// </summary>
    [Serializable]
    public sealed class TbProfilingCategoryNode
    {
        /// <summary>
        /// Constructor for the profiler category node.
        /// </summary>
        /// <param name="nodeCaption">Node caption.</param>
        /// <param name="version">Version of the node.</param>
        /// <param name="childList">Sub-nodes list.</param>
        /// <param name="color">Preferred color of the node (to be used by the UI).</param>
        /// <param name="toxProfilerDefinition">Relevant metadata table.</param>
        public TbProfilingCategoryNode(string nodeCaption, int version, Color color,
            IEnumerable<TbProfilingCategoryNode> childList,
            IEnumerable<TbToxicologicalProfilerInfoItem> toxProfilerDefinition=null)
        {
            NodeCaption = nodeCaption;

            ChildList = childList != null
                ? new List<TbProfilingCategoryNode>(childList)
                : new List<TbProfilingCategoryNode>();

            Version = version;
            Color = color;
            ToxProfilerDefinition = toxProfilerDefinition != null
                ? new List<TbToxicologicalProfilerInfoItem>(toxProfilerDefinition)
                : new List<TbToxicologicalProfilerInfoItem>();
        }

        /// <summary>
        /// Node caption. This will be used in the UI. 
        /// </summary>
        public string NodeCaption { get; }
        /// <summary>
        /// Version of the profiling category.
        /// </summary>
        public int Version { get; }
        /// <summary>
        /// Preferred color (to be used by the UI)
        /// </summary>
        public Color Color { get; }

        /// <summary>
        /// Child categories.
        /// </summary>
        public IReadOnlyList<TbProfilingCategoryNode> ChildList { get; }

        /// <summary>
        /// Relevant metadata table.
        /// </summary>
        public IReadOnlyList<TbToxicologicalProfilerInfoItem> ToxProfilerDefinition { get; }
    }
}