var Component = require('vn/component');

module.exports = new Class({
	Extends: Component,
	Tag: 'htk-step',
	Properties: {
		name: {
			type: String,
			value: null
		},
		validateFunc: {
			type: Function,
			value: null
		},
		showFunc: {
			type: Function,
			value: null
		}
	},

	initialize(props) {
		Component.prototype.initialize.call(this, props);
		this.createRoot('div');
	},

	show() {
		if (this.showFunc)
			this.showFunc();
		this.node.style.display = 'block';
	},

	hide() {
		this.node.style.display = 'none';
	},

	validate() {
		if (this.validateFunc)
			return this.validateFunc();
		return true;
	},

	appendChild(child) {
		if (child instanceof Component)
			child = child.node;
		this.node.appendChild(child);
	}
});