using System;
using GamecraftModdingAPI.Blocks;

namespace GamecraftModdingAPI.Utility
{
    public static class GameClient
    {
        private static DebugInterfaceEngine _engine = new DebugInterfaceEngine();
        
        /// <summary>
        /// Saves the extra information to be displayed on the debug view.
        /// The provided getter function is called each time the view updates so make sure it returns quickly.
        /// </summary>
        /// <param name="id">A global ID for the custom information</param>
        /// <param name="contentGetter">A function that returns the current information</param>
        public static void SetDebugInfo(string id, Func<string> contentGetter) => _engine.SetInfo(id, contentGetter);
        
        /// <summary>
        /// Removes an information provided by a plugin.
        /// </summary>
        /// <param name="id">The ID of the custom information</param>
        /// <returns></returns>
        public static bool RemoveDebugInfo(string id) => _engine.RemoveInfo(id);

        public static void Init()
        {
            GameEngineManager.AddGameEngine(_engine);
        }
    }
}