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

namespace ChatController.Converter
{
    public class UserProfilePictureVisibilityConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if(values != null && values.Length == 2 && values[0] is bool isMyMessage && values[1] is bool isGroupChat)
            {
                if(parameter is string test && test == "reverse")
                {
                    return isMyMessage && isGroupChat ? Visibility.Visible : Visibility.Collapsed;
                }

                return !isMyMessage && isGroupChat ? Visibility.Visible : Visibility.Collapsed;
            }

            return Visibility.Collapsed;
        }

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