using System.Collections.Generic;
using Toolbox.Docking.Api.Chemical;
using Toolbox.Docking.Api.Control;
using Toolbox.Docking.Api.Data;
using Toolbox.Docking.Api.Units;

namespace Toolbox.Docking.Api.Objects.Qsar
{
    /// <summary>
    /// Factory for constructing a Toolbox QSAR object.
    /// </summary>
    public interface ITbQsarFactory : ITbObjectFactory
    {
        /// <summary>
        /// This is the scale definition for the Unit that the calculator will return values in.
        /// <see cref="ITbQsar.Predict"/> shall return all values in a single, consistent unit: 
        ///   for TbRatioScale the same as BaseUnit of this scale (or convertible for system scales);
        ///   for TbQualitativeScale the calculated unit must be member of this scale.
        /// </summary>
        TbScale ScaleDeclaration { get; }

        /// <summary>
        /// Used X descriptors. They can be calculators from Toolbox. 
        /// Or just information for own calculated parameters (provide Guid.Empty)
        /// </summary>
        IReadOnlyList<QsarDescriptorInfo> XDescriptors { get; }

        /// <summary>
        /// Rigid path in Toolbox endpoint tree
        /// </summary>
        IReadOnlyList<string> EndpointLocation { get; }

        /// <summary>
        /// Basic statistics about the model
        /// </summary>
        TbQsarStatistics Statistics { get; }

        /// <summary>
        /// Used to position QSAR at Endpoint tree.
        ///         string Name { get; }
        /// Mandatory: Endpoint, 
        /// Optional: Species, Duration, ExperimentalProtocol, Comments, DataQuality...
        /// </summary>
        TbMetadata Metadata { get; }

        /// <summary>
        /// Text which is shown to the user for the first time using the QSAR. Toolbox uses "remember my choice" for each agreement info
        /// </summary>
        string AgreementInfo { get; }

        /// <summary>
        /// Text to be added to the report when reporting a prediction with this QSAR.
        /// </summary>
        string ReportDisclaimer { get; }

        /// <summary>
        /// Returns the training set for the QSAR
        /// </summary>
        /// <param name="task">Since the loading of a training set may be a slow process
        /// a task is supplied to be used for progress notification </param>
        /// <returns>The QSAR training set.</returns>
        IReadOnlyList<ChemicalWithData> TrainingSet(ITbWorkTask task);

        /// <summary>
        /// Returns the test set for the QSAR
        /// </summary>
        /// <param name="task">Since the loading of a test set may be a slow process
        /// a task is supplied to be used for progress notification </param>
        /// <returns>The QSAR test set.</returns>
        IReadOnlyList<ChemicalWithData> GetTestSet(ITbWorkTask task);

        /// <summary>
        /// Location for the QMRF of the model.
        ///     - in case this string is a valid HTTP or HTTPS URL it is opened in the browser
        ///     <see cref="System.Uri.TryCreate"/>
        ///     <see cref="System.Uri.UriSchemeHttp"/>
        ///     <see cref="System.Uri.UriSchemeHttps"/>
        ///     - else this string is interpreted as a file name and is searched in the config directory of the QSAR on the server.
        /// </summary>
        string QmrfLocation { get; }

        /// <summary>
        /// Returns an initialized, ready to use Toolbox QSAR.
        /// </summary>
        /// <param name="task">Task responsible for the object initialization</param>
        /// <returns>
        /// The initialized Toolbox QSAR
        /// </returns>
        ITbQsar GetQsar(ITbWorkTask task);

        /// <summary>
        /// Description of the calculator.
        /// </summary>
        QsarFlags QsarFlags { get; }
    }
}