﻿using VMLab.Graph;
using VMLab.Helpers;

namespace VMLab.Hypervisor.HyperV
{
    public class HyperVControllerFactory : IHyperVControllerFactory
    {
        private readonly IHyperVPowerShellRunner _hyperVPowerShellRunner;
        private readonly IProcessRunner _processRunner;
        private readonly IConsole _console;
        private readonly IEnvironmentHelper _environmentHelper;
        private readonly IFileSystem _fileSystem;

        public HyperVControllerFactory(IHyperVPowerShellRunner hyperVPowerShellRunner, IProcessRunner processRunner, IConsole console, IEnvironmentHelper environmentHelper, IFileSystem fileSystem)
        {
            _hyperVPowerShellRunner = hyperVPowerShellRunner;
            _processRunner = processRunner;
            _console = console;
            _environmentHelper = environmentHelper;
            _fileSystem = fileSystem;
        }

        public IVMControl Create(string vmId, CredentialSet credset, SharedFolder[] sharedFolders, VMOperatingSystem os,
            OSClass osClass)
        {
            return new HyperVControl(vmId, _hyperVPowerShellRunner, _processRunner, _console, _environmentHelper, osClass, _fileSystem, os, credset);
        }
    }
}
