package app

import (
	"html/template"

	"git.clearsky.net.au/cody/gex.git/app/route/home"
	"git.clearsky.net.au/cody/gex.git/pkg/render"
	"git.clearsky.net.au/cody/gex.git/pkg/sec"
	"git.clearsky.net.au/cody/gex.git/pkg/sess"

	"git.clearsky.net.au/cody/gex.git/pkg/gen"
	"git.clearsky.net.au/cody/gex.git/pkg/srv"
)

func Init() {
	gen.GeneratePages("app")
	render.Include = func(req *srv.Req, props render.Props, funcs render.Funcs) {
		props["Sess"] = req.Ctx["Sess"]
		funcs["Cody"] = func() template.HTML {
			return "GO Fuck yourself"
		}
	}
}

func Middleware() {
	srv.AddMiddleware(sess.Middleware)
	srv.AddMiddleware(sec.Middleware)

}

func Routes() {
	type roles []string
	sec.Route("/{$}", roles{"Everyone"}, home.Index)
}

// props and funcs to include with every render
