package de.bettinggame.ui;

import java.util.ArrayList;
import java.util.List;

/**
 * Enum with navigation links.
 */
public enum Navigation {

    INDEX("navigation.item.index", "/", false),
    LOGIN("navigation.item.login", "/login", false),
    LOGOUT("navigation.item.logout", "/logout", true),
    REGISTER("navigation.item.register", "/register/register", false),
    GROUPS("navigation.item.groups", "/groups", false);

    private String messageKey;
    private String url;
    private boolean onlyAuthenticatedVisible;

    Navigation(String messageKey, String url, boolean onlyAuthenticatedVisible) {
        this.messageKey = messageKey;
        this.url = url;
        this.onlyAuthenticatedVisible = onlyAuthenticatedVisible;
    }

    public String getMessageKey() {
        return messageKey;
    }

    public String getUrl() {
        return url;
    }

    public boolean isOnlyAuthenticatedVisible() {
        return onlyAuthenticatedVisible;
    }

    public static List<Navigation> getNavigationListForAuthentication(boolean authenticated) {
        List<Navigation> navList = new ArrayList<>();
        for (Navigation nav : Navigation.values()) {

        }
        return navList;
    }
}

@@ -38,21 +38,16 @@
 va.util.
-Array
 List;%0Aim
@@ -61,20 +61,65 @@
 va.util.
-Li
 st
+ream.Collectors;%0Aimport java.util.stream.Stream
 ;%0A%0A/**%0A 
@@ -186,156 +186,53 @@
     
-INDEX(%22navigation.item.index%22, %22/%22, false),%0A    LOGIN(%22navigation.item.login%22, %22/login%22, false),%0A    LOGOUT(%22navigation.item.logout%22, %22/logout%22, tru
+LOGIN(%22navigation.item.login%22, %22/login%22, fals
 e),%0A
@@ -976,140 +976,120 @@
 ion(
-boolean authenticated) %7B%0A        List%3CNavigation%3E navList = new ArrayList%3C%3E();%0A        for (Navigation nav : Navigation.values()) %7B%0A
+) %7B%0A        return Stream.of(Navigation.values())%0A                .filter(item -%3E item.onlyAuthenticatedVisible)
 %0A   
@@ -1097,18 +1097,16 @@
     
-%7D%0A
         
 retu
@@ -1105,22 +1105,37 @@
     
-return nav
+.collect(Collectors.to
 List
+())
 ;%0A  

Remove obsolete navigation links