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

namespace ReAct_PME
{
    #region RoleToColorTextConverter
    public class RoleToColorTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
            value?.ToString() switch
            {
                "user" => Brushes.White,
                "assistant" => Brushes.Black,
                _ => Brushes.LightGray
            };

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
            throw new NotImplementedException();
    }

    #endregion

    #region RoleToColorConverter
    public class RoleToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
            value?.ToString() switch
            {
                "user" => Brushes.Blue,
                "assistant" => Brushes.SandyBrown,
                _ => Brushes.LightGray
            };

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
            throw new NotImplementedException();
    }
    #endregion

    #region RoleToAlignmentConverter
    public class RoleToAlignmentConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
            value?.ToString() == "user" ? HorizontalAlignment.Right : HorizontalAlignment.Left;

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
            throw new NotImplementedException();
    }
    #endregion

    #region RoleToIconConverter
    public class RoleToIconConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
            value?.ToString() == "user" ? "👤" : "🤖";

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
            throw new NotImplementedException();
    }
    #endregion

    #region NullToBoolConverter
    public class NullToBoolConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value == null ? "Non" : "Oui";// value != null; // Retourne true si la valeur n'est pas nulle
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException(); // Non utilisé ici
        }
    }
    #endregion

    #region BoolToStatusConverter
    public class BoolToStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            bool boolValue = value is bool b && b;
            //return !boolValue ? "Archiver" : "ReOuvrir";

            // Si false → "E74D", si true → "E785"
            int codePoint = !boolValue ? 0xE74D : 0xE785;

            // Convertit le code Unicode en chaîne
            return char.ConvertFromUtf32(codePoint);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException(); // Non utilisé ici
        }
    }
    #endregion

    #region BoolToBrushConverter
    public class BoolToBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SolidColorBrush brush = Brushes.White;
            if(value != null)
            {

            }
            return brush;
        }

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

	#region OrigineToBrushConverter
	public class OrigineToBrushConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SolidColorBrush brush = Brushes.White;
            if(value != null)
            {


            }
            return brush;
        }

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

                