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

namespace WpfDataGrid.Converter
{
    [ValueConversion(typeof(Model.DataItem), typeof(string))]
    class ItemStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Model.DataItem item)
            {
                return item.RawValue > item.Value
                    ? "/Images/Tick.png"
                    : "/Images/Cross.png";
            }

            return string.Empty;
        }

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