using Avalonia.Data.Converters;
using System;
using System.Collections.Generic;
using System.Globalization;

namespace Harmonia.UI.Converters;

public class ArtistsToStringConverter : IValueConverter
{
    public ArtistsToStringConverter()
    {

    }

    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is not List<string>)
            return string.Empty;

        List<string> artists = (List<string>)value;

        if (artists == null)
            return string.Empty;

        return string.Join(" / ", artists);
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        return new List<string>();
    }
}