class systemController extends EICController {

    /**
     * Platform access control
     * 
     * @param {*} params 
     */
    control() {
        app.meta.add('user-roles', app.Assets.Store.json['user-roles']);
        app.meta.add('user-messages', app.Assets.Store.json['user-messages']);
        let models = {
            platform: new PlatformModel()
        }
        
        this.loadWindow(
            'system/admin/platform-control/AdminAccessControlView', 
            { title: 'Platform Control', static: true, expanded: true },
            { models: models }
        );
    }

    explore() {
        
        
        app.User.getBusinessPermissions([ '/storage/entities' ], 'EIC_Admin')
        .then(payload => {

            console.log(payload)
        
            let models = {
                ml: new MarklogicModel(payload['/storage/entities'].permissions)
            }
            
            this.loadWindow(
                'system/admin/explorer/DataExplorerView', 
                { title: 'Data explorer', static: true, expanded: true },
                { models: models }
            );
        })
    }

    /**
     * System Health check content
     * 
     * @param {*} params 
     */
    healthcheck() { 
        
        this.loadWindow('system/tools/statusView', {
                title: 'Health Check', 
                static: true,
                expanded: true
            }
        );
    }

    /**
     * 
     */
    async styleguide() { 

        await Loader.loadViews(["system/tools/styleguideView"]);
        
        this.loadWindow('system/tools/styleguideView', {
            title: 'Style guide', 
            static: true,
            expanded: true
        });
    }

    /**
     * 
     */
    async eicui() { 

        await Loader.loadViews(["system/tools/EICUIView"]);
        
        this.loadWindow(
            'system/tools/EICUIView', 
            { title: 'EICUI', static: true, expanded: true}
        );
    }

    sampler(params) { 
        this.loadWindow(
            'system/lab/SamplerView', 
            { title: 'SAMPLER3000', static: true, expanded: true }
        );
    }

    chalkboard(params) { 
        this.loadWindow(
            'system/lab/ChalkboardView', 
            { title: 'Chalkboard', static: true, expanded: true }
        );
    }

    components(params) { 
        this.loadWindow('system/lab/ComponentLabView', {
            title: 'Component Lab', 
            static: true,
            expanded: true
        });
    }
}

app.registerClass('systemController', systemController);