using System;
using System.Collections.Generic;
using System.Linq;

namespace Toolbox.Docking.Api.Data
{
    /// <summary>
    /// Toolbox metadata object.
    /// </summary>
    [Serializable]
    public sealed class TbMetadata
    {
        /// <summary>
        /// Toolbox metadata object constructor.
        /// </summary>
        /// <param name="stringMetadata">The list with <b>string</b> metadata values.</param>
        /// <param name="valueMetadata">The list with TbData numerical values.</param>
        public TbMetadata(IReadOnlyDictionary<string, string> stringMetadata, 
            IReadOnlyDictionary<string, TbData> valueMetadata)
        {
            ValueMetadata = valueMetadata?.ToDictionary(kv => kv.Key, kv => kv.Value);
            StringMetadata = stringMetadata?.ToDictionary(kv => kv.Key, kv => kv.Value);
        }

        /// <summary>
        /// Text metadata value pairs (e.g. Endpoint=EC50).
        /// </summary>
        public IReadOnlyDictionary<string, string> StringMetadata{ get; }

        /// <summary>
        /// Numerical, structured metadata value 
        /// i.e. MetadataLabel=Value in a Unit
        /// (e.g. Duration = 96 h) 
        /// </summary>
        public IReadOnlyDictionary<string, TbData> ValueMetadata{ get; }
    }
}