using System.Collections.Generic;
using System.Linq;
using BS.Shared.DataContracts;
using System.Windows.Media;
using System.Reflection;

using Color = System.Drawing.Color;

namespace BeWo.ViewModel.ListViewModel
{
    public class AbsenceReasonListVM : AbstractDCListMapperVM<AbsenceReasonDC, AbsenceReasonVM>
    {
        public AbsenceReasonListVM(List<AbsenceReasonDC> pDCs) : base(pDCs)
        {
        }

        public List<SolidColorBrush> AllBrushes
        {
            get
            {
                var lTemp = typeof(Color).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Static).Select(pi => (Color)pi.GetGetMethod().Invoke(null, null)).ToList();

                lTemp.Sort((x, y) => x.GetBrightness().CompareTo(y.GetBrightness()));

                return lTemp.Select(c => new SolidColorBrush(System.Windows.Media.Color.FromArgb(c.A, c.R, c.G, c.B))).ToList();
            }
        }
    }
}