/**
 */
var controller = {
    name: 'Rest test',

    registerMenu: function(menu, nga, entity) {
        menu.addChild(
            nga
                .menu(entity)
                .title('Rest test')
                .icon('<span class="glyphicon glyphicon-user"></span> ')
        );
    },

    register: function(admin, nga, menu) {
        let entity = this.registerEntities(admin, nga);
        this.registerMenu(menu, nga, entity);
    },

    registerEntities: function(admin, nga) {
        let browser = new EntityManager('rest', admin, nga, {
            // customTemplates: ['edit']
        });

        return browser
            .baseurl('/api/rest-datastore-api')
            .fields({
                key: {
                    label: 'Clave',
                    primary: true,
                },
                name: {
                    label: 'Nombre',
                },
                married: {
                    label: 'Married',
                    type: 'boolean',
                    required: true,
                },
                age: {
                    label: 'Age',
                    type: 'number',
                },
            })
            .register();
    },

    registerApp: function(app) {

        app.controller('rest', function($scope, $http, $q, $timeout, progression, $window) {
        });
    }
};

adminControllers.push(controller);