using System.Globalization;
using Avalonia.Data.Converters;
using Avalonia.Media;
using ClaudeDo.Ui.ViewModels.Modals;

namespace ClaudeDo.Ui.Converters;

public sealed class DiffLineKindToBrushConverter : IValueConverter
{
    public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
        value is WorktreeDiffLineKind kind
            ? kind switch
            {
                WorktreeDiffLineKind.Added   => new SolidColorBrush(Color.Parse("#66BB6A")),
                WorktreeDiffLineKind.Removed => new SolidColorBrush(Color.Parse("#EF5350")),
                WorktreeDiffLineKind.Hunk    => new SolidColorBrush(Color.Parse("#42A5F5")),
                WorktreeDiffLineKind.Header  => new SolidColorBrush(Color.Parse("#9E9E9E")),
                _                            => new SolidColorBrush(Color.Parse("#CFD8DC")),
            }
            : new SolidColorBrush(Color.Parse("#CFD8DC"));

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