var Class = require('class-wrapper').Class;
var fs = require('fs');

var InputAdapter = require('./inputAdapter');
var Position = require('./position');
var Rendering = require('./rendering');
var outputAdapter = require('./outputAdapter');

global.document = require('jsdom').jsdom('<body>');

var Diagram = Class(function(noiName, nodeMap, css) {
	this.inAdapter.setNodeMap(nodeMap);
	var noi = this.inAdapter.prepareNOI(noiName);
	this.inAdapter.prepareOtherNodes();

	this.position.setNOI(noi);
	var nodes = this.position.position();

	var domElement = this.rendering.render(nodes);

	var out = this.outAdapter(domElement, css);

	fs.writeFile('out.svg', out, err => {
		if (err) {
			throw err;
		}

		console.log('Done.');
	});
}, {
	inAdapter: new InputAdapter(),
	position: new Position(),
	rendering: new Rendering(),
	outAdapter: outputAdapter
});

module.exports = Diagram;

@@ -352,44 +352,8 @@
 his.
-inAdapter.setNodeMap(nodeMap);%0A%09var 
 noi 
@@ -391,132 +391,75 @@
 Name
-);%0A%09this.inAdapter.prepareOtherNodes();%0A%0A%09this.position.setNOI(noi);%0A%09var nodes = this.position.position();%0A%0A%09var domElement
+, nodeMap);%0A%0A%09this.positing.position(this.noi);%0A%0A%09this.domContainer
  = t
@@ -483,17 +483,19 @@
 der(
-nodes
+this.noi
 );%0A
-%0A
 %09var
@@ -524,15 +524,17 @@
 (dom
-Element
+Container
 , cs
@@ -643,16 +643,50 @@
 );%0A%7D, %7B%0A
+%09noi: null,%0A%09domContainer: null,%0A%0A
 %09inAdapt
@@ -716,18 +716,18 @@
 %0A%09positi
-o
 n
+g
 : new Po

update the interface and store interesting objects