using System;
using System.Globalization;
using Xamarin.Forms;

namespace InABox.Mobile
{
    public class BooleanToLayoutOptionsConverter : IValueConverter
    {
        public LayoutOptions TrueValue { get; set; }
        public LayoutOptions FalseValue { get; set; }
        
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return TrueValue;
            //if ((value is bool bvalue) && bvalue)
            //    return TrueValue;
            //return FalseValue;
        }

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