using Ninject.Extensions.ChildKernel;
using System.ComponentModel;
using Ninject;
using VisionBuilder.UI.Common;
using VisionBuilder.UI.IOCommander.Interfaces;
using VisionBuilder.UI.IOCommander.Settings;
using VisionBuilder.UI.IOCommander.Windows;

namespace VisionBuilder.UI.IOCommander;

public static class ModuleExtensions
{
    public static IKernel UseIOCommanderWindowsDebug(this IKernel self)
    {
        TypeDescriptor.AddAttributes(typeof(List<PinLabel>), new TypeConverterAttribute(typeof(PinLabelListConverter)));
        self.Rebind<IIOCommanderDebugViewService>().To<WindowsIOCommanderDebugViewService>().InSingletonScope();
        self.Bind<WindowsIOCommanderDebugViewSettings,ISettings>().ToConstant(new WindowsIOCommanderDebugViewSettings());
        return self;
    }

    public static IKernel UseIOCommanderVirtualInput(this IKernel self)
    {
        self.Bind<VirtualInputSettings, ISettings>().To<VirtualInputSettings>().InSingletonScope();
        self.Rebind<IIOCommanderFactory>().To<IOCommanderVirtualInputFactory>().InSingletonScope();
        return self;
    }
}