using System;
using System.Collections.Generic;
using System.Windows.Media;

namespace InABox.WPF;

public class GuidToImageSourceConverter : AbstractConverter<Guid,ImageSource?>
{
    public Dictionary<Guid, byte[]>? Images { get; init; }
    
    public override ImageSource? Convert(Guid value)
    {
        if (Images?.TryGetValue(value, out byte[]? result) == true)
            return ImageUtils.BitmapImageFromBytes(result);
        return null;
    }
    
}