namespace HistoryView.Converters;

public class Mini8StatusToDisconnect : IMultiValueConverter
{
    public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value.Length<2)
            return Visibility.Collapsed;

        if (value[0] is not bool isConnected)
            return Visibility.Collapsed;

        if (value[1] is not bool isEnable)
            return Visibility.Collapsed;

        if (!isEnable)
            return Visibility.Collapsed;

        return isConnected switch
        {
            false => Visibility.Visible,
            _ => Visibility.Collapsed
        };
    }

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