
namespace HistoryView.Converters;

public class InhibitToBool : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not Inhibit inhibit)
            return false;

        return inhibit switch
        {
            Inhibit.Enable => true,
            Inhibit.Disable => false,
            _ => false
        };

    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not bool enable)
            return false;

        return enable switch
        {
            true => Inhibit.Enable,
            false => Inhibit.Disable,
        };
    }
}
