namespace Zcbot.WindowsNode; internal sealed class NodeCompositionRoot { internal NodeCompositionRoot(NodePaths paths) { Paths = paths; ConfigStore = new NodeConfigStore(paths); } internal NodePaths Paths { get; } internal NodeConfigStore ConfigStore { get; } internal NodeApplicationController CreateApplicationController() => new( ConfigStore, Paths, (config, statusChanged) => new NodeConnectionLoop(config, Paths, statusChanged), EnrollmentClient.EnrollAsync, NodeDataMigrator.MigrateAsync, NodeDataRootSettings.SaveUserRoot); internal async Task RunHeadlessAsync(CancellationToken cancellationToken) { var config = ConfigStore.Load(); await new NodeConnectionLoop(config, Paths).RunAsync(cancellationToken); } }