using System.Collections.Generic;

namespace Aitex.Core.Util
{
    public class ModuleStatusBackground
    {
        public const string Init = "Yellow";
        public const string Error = "OrangeRed";
        public const string Busy = "LawnGreen";
        public const string Idle = "White";
        public const string Offline = "Gray";
        public const string UnInstalled = "Gray";
        private static Dictionary<string, string> _dicCustom = new Dictionary<string, string>();

        public static string GetStatusBackground(string status)
        {
            if (status != null)
                status = status.Trim().ToLower();
            switch (status)
            {
                case "error":
                    return "OrangeRed";
                case "idle":
                case "manual":
                case "processidle":
                case "vacidle":
                    return ModuleStatusBackground._dicCustom.ContainsKey("White") ? ModuleStatusBackground._dicCustom["White"] : "White";
                case "init":
                case "notconnect":
                    return "Yellow";
                case "notinstall":
                    return "Gray";
                case "offline":
                    return "Gray";
                default:
                    return "LawnGreen";
            }
        }

        public static void CustomColor(string type, string color) => ModuleStatusBackground._dicCustom[type] = color;
    }
}
