using System;
using System.Collections.Generic;
using System.Globalization;
using detect.gui.Models;
using Avalonia;
using Avalonia.Data.Converters;

namespace detect.gui.Converters;

public class SidebarMarginConverter : IMultiValueConverter
{
    public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
    {
        if (values.Count != 2) return new Thickness(0);
        var user = (UserModel?)((values[0] is UnsetValueType ? null : values[0]) ?? null);
        var height = (double)(values[1] ?? 0);
        return user == null ? new Thickness(0) : new Thickness(0,0,0,height);
    }
}