// Path: src/main/java/se/omegapoint/facepalm/client/models/User.java
// public class User {
//     public final String username;
// 
//     public User(final AuthenticatedUser authenticatedUser) {
//         notNull(authenticatedUser);
//         this.username = authenticatedUser.userName;
//     }
// }
// 
// Path: src/main/java/se/omegapoint/facepalm/client/security/AuthenticatedUser.java
// public class AuthenticatedUser {
//     public final String userName;
// 
//     public AuthenticatedUser(final String userName) {
//         this.userName = notBlank(userName);
//     }
// }


import com.google.common.collect.ImmutableMap;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import se.omegapoint.facepalm.client.models.User;
import se.omegapoint.facepalm.client.security.AuthenticatedUser;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
package se.omegapoint.facepalm.client.controllers;



@Controller
public class SimpleErrorController implements ErrorController {

    private static final String PATH = "/error";
    private static final Map<Integer, String> ERROR_TEXTS = ImmutableMap.of(
            404, "The page you were looking for those not exist"
            // Rest is default
    );
    private static final String DEFAULT_ERROR_MESSAGE = "Oops! An error has occurred. Please contact admin if the problem persists and ask them to check the logs.";

    @RequestMapping(value = PATH)
    public String error(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse, final Model model) {
        model.addAttribute("user", user());
        model.addAttribute("errorText", mapFromStatus(servletResponse.getStatus()));
        return "error";
    }

    @Override
    public String getErrorPath() {
        return PATH;
    }

// Path: src/main/java/se/omegapoint/facepalm/client/models/User.java
// public class User {
//     public final String username;
// 
//     public User(final AuthenticatedUser authenticatedUser) {
//         notNull(authenticatedUser);
//         this.username = authenticatedUser.userName;
//     }
// }
// 
// Path: src/main/java/se/omegapoint/facepalm/client/security/AuthenticatedUser.java
// public class AuthenticatedUser {
//     public final String userName;
// 
//     public AuthenticatedUser(final String userName) {
//         this.userName = notBlank(userName);
//     }
// }


// Path: src/main/java/se/omegapoint/facepalm/client/controllers/SimpleErrorController.java
import com.google.common.collect.ImmutableMap;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import se.omegapoint.facepalm.client.models.User;
import se.omegapoint.facepalm.client.security.AuthenticatedUser;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

package se.omegapoint.facepalm.client.controllers;



@Controller
public class SimpleErrorController implements ErrorController {

    private static final String PATH = "/error";
    private static final Map<Integer, String> ERROR_TEXTS = ImmutableMap.of(
            404, "The page you were looking for those not exist"
            // Rest is default
    );
    private static final String DEFAULT_ERROR_MESSAGE = "Oops! An error has occurred. Please contact admin if the problem persists and ask them to check the logs.";

    @RequestMapping(value = PATH)
    public String error(final HttpServletRequest servletRequest, final HttpServletResponse servletResponse, final Model model) {
        model.addAttribute("user", user());
        model.addAttribute("errorText", mapFromStatus(servletResponse.getStatus()));
        return "error";
    }

    @Override
    public String getErrorPath() {
        return PATH;
    }

    public User user() {