define(['scripts/knockout-3.3.0','scripts/ACTComponent.js'], function(ko, ACTComponent) {

	function AboutWizardComponentViewModel(params, element) {
		var self = this;

		self.base = new ACTComponent($(element), params);

		self.icon = ko.observable();
		self.name = ko.observable();
		self.author = ko.observable();
		self.version = ko.observable();
		self.description = ko.observable();
		self.steps = ko.observableArray([]);

		self.transTextAuthor      = ko.observable(params.Model.TranslatedTexts["Author"]);
		self.transTextVersion     = ko.observable(params.Model.TranslatedTexts["Version"]);
		self.transTextStep        = ko.observable(params.Model.TranslatedTexts["Step"]);
		self.transTextDescription = ko.observable(params.Model.TranslatedTexts["Description"]);

		self.base.onRefresh = function(obj) {
			self.icon(obj.Icon);
			self.name(obj.Name);
			self.author(obj.Author);
			self.version(obj.Version);
			self.description(obj.Description);

			var lineHeightValue;
			if (self.description() == "") {
				lineHeightValue = "48px";    // img size
			} else {
				lineHeightValue = "100%";
			}
			var nameElement = $(element).find(".name");
			nameElement.css("line-height", lineHeightValue);

			var newSteps = [];
			for (var step in obj.Objects) {
				var des = obj.Objects[step];
				var newStep = {Name: step, Description: des};
				newSteps.push(newStep);
			}
			self.steps(newSteps);
		}

		self.base.initialize();
		params.ready(true);
	}

	return {
		createViewModel: function(params, componentInfo) {
			return new AboutWizardComponentViewModel(params, componentInfo.element);
		}
	};

});

