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, shoul dbe overridden
    }

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

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

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

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