using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
using System.Windows.Media;

using BeWo.View;

using BS.Shared;
using BS.Shared.Core;

namespace BeWo.Converter
{
    public class BoolScaleTransformConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return ((bool)value) ? new ScaleTransform { ScaleX = 1, ScaleY = 1 } : new ScaleTransform { ScaleX = 0, ScaleY = 0 };
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class UserRightTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var i = (value as IEnumerable<UserRightType>).ToList();

            i.Remove(UserRightType.None);

            return (i != null) ? i.Select(r => EnumTranslations.UserRightType2Translations.Single(f => f.Key == r)).OrderBy(l => l.Value).ToDictionary(t => t.Key, t => t.Value) : value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}