using System;
using System.Reflection;

namespace DualScreenDemo
{
    public static class EnumExtensions
    {
        public static string GetDescription(this Enum value, bool isSimplified = false)
        {
            var field = value.GetType().GetField(value.ToString());

            var attr = field?.GetCustomAttribute<LocalizedDescriptionAttribute>();
            if (attr != null)
                return isSimplified ? attr.Simplified : attr.Traditional;

            return value.ToString();
        }
    }
}
