package routing

import (
	"git.markbailey.dev/cerbervs/ptpp/handlers/admin"
	"git.markbailey.dev/cerbervs/ptpp/handlers/shared"
	"git.markbailey.dev/cerbervs/ptpp/lib/middleware"
	"net/http"
)

var AppRouter = Router{
	Mux:      http.NewServeMux(),
	BasePath: "/",
	Routes: []Route{
		{Controller: &shared.HomePageHandler{}, Path: "", Name: "app.index"},
		{Controller: &shared.SignUpHandler{}, Path: "sign-up", Name: "app.user.sign_up"},
		{Controller: &shared.SignInHandler{}, Path: "sign-in", Name: "app.user.sign_in"},
		{Controller: &shared.SignOutHandler{}, Path: "sign-out", Name: "app.user.sign_out"},
		{Controller: &shared.PopulateHandler{}, Path: "populate", Name: "app.populate"},
	},
	SubRouters: &[]Router{
		{
			Mux:      nil,
			BasePath: "admin/",
			Routes: []Route{
				{Controller: &admin.IndexHandler{}, Path: "", Name: "app.admin.index"},
				{Controller: &admin.IndexHandler{}, Path: "butt", Name: "app.admin.butt"},
			},
			SubRouters: nil,
			Middleware: &[]middleware.Func{middleware.WithAuth},
		},
	},
	Middleware: &[]middleware.Func{middleware.WithLogger, middleware.WithUsername},
}
