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

namespace Toolbox.Docking.Api.Objects
{
    /// <summary>
    /// A class containing the about information for the Toolbox object (QSAR, calculator, profile etc.). This will be displayed
    /// on various places within the Toolbox Client's UI most often via an About button.
    /// </summary>
    [Serializable]
    public sealed class TbObjectAbout
    {
        /// <summary>
        /// Constructor for object about.
        /// </summary>
        /// <param name="description">A description of the object</param>
        /// <param name="donator">The donator of the object</param>
        /// <param name="disclaimer">A disclaimer for the object</param>
        /// <param name="authors">Authors of the object</param>
        /// <param name="url">A URL for navigation to additional information about the object</param>
        /// <param name="name">The name of the object</param>
        /// <param name="helpFile">The documentation file name</param>
        /// <param name="additionalInfo">Additional information provided in name-value pairs</param>
        public TbObjectAbout(string description, string donator, string disclaimer, string authors,
            string url, string name, string helpFile, IEnumerable<TbObjectAboutTextPair> additionalInfo)
        {
            Description = description;
            Donator = donator;
            Disclaimer = disclaimer;
            Authors = authors;
            Url = url;
            Name = name;
            HelpFile = helpFile;
            AdditionalInfo = additionalInfo?.ToList();
        }

        /// <summary>
        /// The name of the object
        /// </summary>
        public string Name { get; }
        /// <summary>
        /// A description of the object
        /// </summary>
        public string Description { get; }
        /// <summary>
        /// The donator of the object
        /// </summary>
        public string Donator { get; }
        /// <summary>
        /// A disclaimer for the object
        /// </summary>
        public string Disclaimer { get; }
        /// <summary>
        /// Authors of the object
        /// </summary>
        public string Authors { get; }
        /// <summary>
        /// A URL for navigation to additional information about the object
        /// </summary>
        public string Url { get; }
        /// <summary>
        /// Additional information provided in name-value pairs
        /// </summary>
        public IReadOnlyList<TbObjectAboutTextPair> AdditionalInfo { get; }
        /// <summary>
        /// The documentation file name (if any). This file is searched in the config directory of the Toolbox object on the server.
        ///     - If the file is ZIP then it is extracted to a folder on the client. Then the system searches for a file in the folder with the same name as the ZIP and opens by a default program chosen by the OS.
        ///     - Else the file is saved on the client and opened by a default program chosen by the OS
        /// </summary>
        public string HelpFile { get; }
    }
}
