export default class BaseController
{
	constructor(app, view, name)
	{
		this.app = app;
		this.view = view;
		this.name = name;
	}

	get sfs() {
		return this.app.getSfsClient();
	}

	initialize()
	{
		// Nothing to do, should be overridden
	}

	destroy()
	{
		// Hide view
		this.showView(false);

		// Remove controller's SFS event listeners
		this.removeSmartFoxListeners();
	}

	removeSmartFoxListeners()
	{
		throw new Error('BaseController.removeSmartFoxListeners() method must be overridden by controller');
	}

	showView(show = true)
	{
		this.view.hidden = !show;
	}
}
