using System.Collections.Generic;
using StreamBuddy.PluginInterface.Features;

namespace StreamBuddy.PluginInterface
{
    /// <summary>
    /// Defines an interface for accessing bot data.
    /// </summary>
    public interface IPluginService
    {
        /// <summary>
        /// A list of registered features from all plugins.
        /// </summary>
        IReadOnlyList<IFeature> Features { get; }
        /// <summary>
        /// A list of all loaded plugins.
        /// </summary>
        IReadOnlyList<IPlugin> Plugins { get; }
        /// <summary>
        /// A list of all enabled streams.
        /// </summary>
        IReadOnlyList<IStream> Streams { get; }
        /// <summary>
        /// The connection for the global persistance database
        /// </summary>
        SQLite.SQLiteConnection PersistanceConnection { get; }
        /// <summary>
        /// The connection for the in-memory database
        /// </summary>
        SQLite.SQLiteConnection TemporaryConnection { get; }

		void ScheduleTask(System.Action action, string Schedule, string Name = null);
		void UnscheduleTask(System.Action action);

        /// <summary>
        /// Reloads the plugin list, will load new plugins but not reload changed ones or unload ones that have gone.
        /// </summary>
        void ReloadPlugins();
        /// <summary>
        /// Gets the plugin instance with the given name.
        /// </summary>
        /// <param name="Name">The name of the plugin to find.</param>
        /// <returns>The plugin with the name given, or <seealso cref="null"/> if it's not found.</returns>
        IPlugin GetPlugin(string Name);

        /// <summary>
        /// Adds the bot to the given stream.
        /// </summary>
        /// <param name="Name">The stream to enable the bot on.</param>
        /// <returns>An <seealso cref="IStream"/> reference for the stream.</returns>
        IStream AddStream(string Name);
        /// <summary>
        /// Gets the stream object for the given stream name.
        /// </summary>
        /// <param name="Name">The name of the stream-</param>
        /// <returns>The stream object with the given name, or <seealso cref="null"/> if it doesn't exist</returns>
        IStream GetStream(string Name);
        /// <summary>
        /// Removes the bot from the given stream.
        /// </summary>
        /// <param name="Name">The name of the stream it is to be removed from.</param>
        /// <param name="Reason">The reason given for the removal, may be null</param>
        void RemoveStream(string Name, string Reason = null);
    }
}
