using System;
using System.Windows.Data;
using System.Globalization;

namespace Elwig.Controls {
    public class BoolToValueConverter<T> : IValueConverter {
        public T FalseValue { get; set; }
        public T TrueValue { get; set; }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            return (bool)value ? TrueValue : FalseValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            return value?.Equals(TrueValue) ?? false;
        }
    }

    public class BoolToStringConverter : BoolToValueConverter<string> { }
}
