module.exports.menuDefine = function(permission = []) {
	let menu = [];

	menu.push({
	    header: true,
	    title: 'Main Navigation',
	});
    /////////////////////////////////////////////////////
	menu.push({
        title: 'Dashboard',
        icon: 'fa fa-home',
        child: [
            {
                href: '/',
                title: 'Analytics',
            },
        ]
    });
  
    /////////////////////////////////////////////////////
    if (permission.includes('view user')) {
            let admin_access_menu = {};
            admin_access_menu = {
                title: 'User',
                icon: 'fa fa-user',
                child: [
                    {
                        href: '/user/list',
                        title: 'List',
                    },
                ]
            };
            menu.push(admin_access_menu);
    }
  
    /////////////////////////////////////////////////////
	if (permission.includes('view admin')) {
			let admin_access_menu = {};
			admin_access_menu = {
                title: 'Admin',
                icon: 'fa fa-user-astronaut',
                child: [
                    {
                        href: '/admin/list',
                        title: 'List',
                    },
                ]
            };

			if (permission.includes('add admin')) {
				admin_access_menu.child.push(
					{
                        href: '/admin/create',
                        title: 'Create',
                    }
				);
			}
			menu.push(admin_access_menu);
	}
    /////////////////////////////////////////////////////
	if (permission.includes('view role')) {
			let admin_access_menu = {};
			admin_access_menu = {
                title: 'Role',
                icon: 'fa fa-user-tag',
                child: [
                    {
                        href: '/admin-role/list',
                        title: 'Admin List',
                    },
                    {
                        href: '/reviewer-role/list',
                        title: 'Reviewer List',
                    },
                ]
            };

			menu.push(admin_access_menu);
	}
    /////////////////////////////////////////////////////
   
	return menu;
};
