package wrouter

import (
	"net/http"

	"git.aiterp.net/gisle/wrouter/auth"
)

// FunctionHandlerFunc is simply a function that is called directly rather than through a struct
type FunctionHandlerFunc func(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool

type functionHandler struct {
	function FunctionHandlerFunc
}

func (handler *functionHandler) Handle(path string, w http.ResponseWriter, req *http.Request, user *auth.User) bool {
	return handler.function(path, w, req, user)
}