using System;

namespace CefSharpWrap.AceEditorWrap
{
    internal class EnumValueAttribute : Attribute
    {
        public string Value { get; }

        public EnumValueAttribute(string value)
        {
            Value = value;
        }
    }

    internal static class EnumExtensionMethod
    {
        public static string GetEnumValue(this AceEditorTheme me)
        {
            var type = me.GetType();
            var memInfo = type.GetMember(me.ToString());
            var attributes = memInfo[0].GetCustomAttributes(typeof(EnumValueAttribute), false);
            var value = ((EnumValueAttribute)attributes[0]).Value;
            return value;
        }

        public static string GetEnumValue(this AceEditorMode me)
        {
            var type = me.GetType();
            var memInfo = type.GetMember(me.ToString());
            var attributes = memInfo[0].GetCustomAttributes(typeof(EnumValueAttribute), false);
            var value = ((EnumValueAttribute)attributes[0]).Value;
            return value;
        }
    }
}
