namespace DeviceScanner.Controls;

public partial class NewDevicePlot : UserControl
{
    public NewDevicePlot()
    {
        InitializeComponent();
    }

    public DeviceInfo_VM DeviceInfo
    {
        get { return (DeviceInfo_VM)GetValue(DeviceInfoProperty); }
        set { SetValue(DeviceInfoProperty, value); }
    }

    public static readonly DependencyProperty DeviceInfoProperty =
        DependencyProperty.Register("DeviceInfo", typeof(DeviceInfo_VM), typeof(NewDevicePlot), new PropertyMetadata(default));





    public ICommand CreateCommand
    {
        get { return (ICommand)GetValue(CreateCommandProperty); }
        set { SetValue(CreateCommandProperty, value); }
    }

    public static readonly DependencyProperty CreateCommandProperty =
        DependencyProperty.Register("CreateCommand", typeof(ICommand), typeof(NewDevicePlot), new PropertyMetadata(default));




}

internal class DeviceImageConverter : IValueConverter
{
    public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is not DeviceModel deviceModel)
            return null;

        return deviceModel switch
        {
            DeviceModel.JetKepler => new BitmapImage(new Uri("/DeviceManagement;component/Resources/Kepler.png", UriKind.Relative)),
            DeviceModel.Proxima => new BitmapImage(new Uri("/DeviceManagement;component/Resources/Furnace.png", UriKind.Relative)),
            _ => null
        };

    }

    public object? ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return null;
    }
}
