using VisionBuilder.UI.IOCommander.Interfaces;
using VisionBuilder.UI.IOCommander.Settings;

namespace VisionBuilder.UI.IOCommander.Windows;

public class IOCommanderVirtualInputFactory: IIOCommanderFactory
{
    private readonly VirtualInputSettings _settings;
    private readonly DefaultIOCommanderFactory _defaultFactory;

    public IOCommanderVirtualInputFactory(VirtualInputSettings settings, IOCommanderSettings ioCommanderSettings)
    {
        _settings = settings;
        _defaultFactory = new DefaultIOCommanderFactory(ioCommanderSettings);
    }

    public IIOCommander Create()
    {
        if (_settings.Enabled)
        {
            var res = new IOCommanderVirtualInput();
            res.Show();
            return res;
        }
        
        return _defaultFactory.Create();
    }
}