package hub

import "net/http"

func (a *App) registerRoutes() {
	a.mux.Handle("GET /static/", http.FileServerFS(staticFS))
	a.handlePub("GET /", a._root)

	a.handleNotSignedIn("GET  /sign-in/", a._signin)
	a.handleNotSignedIn("POST /sign-in/", a._signinSubmit)

	a.handleSignedIn("GET  /admin/sign-out/", a._adminSignOut)
	a.handleSignedIn("POST /admin/sign-out/", a._adminSignOutSubmit)

	a.handleSignedIn("GET  /admin/network/list/", a._adminNetworkList)
	a.handleSignedIn("GET  /admin/network/create/", a._adminNetworkCreate)
	a.handleSignedIn("POST /admin/network/create/", a._adminNetworkCreateSubmit)
	a.handleSignedIn("GET  /admin/network/delete/", a._adminNetworkDelete)
	a.handleSignedIn("POST /admin/network/delete/", a._adminNetworkDeleteSubmit)

	a.handleSignedIn("GET  /admin/network/view/", a._adminNetworkView)
	a.handleSignedIn("GET  /admin/network/hosts/", a._adminNetworkHosts)
	a.handleSignedIn("GET  /admin/peer/create/", a._adminPeerCreate)
	a.handleSignedIn("POST /admin/peer/create/", a._adminPeerCreateSubmit)
	a.handleSignedIn("GET  /admin/peer/view/", a._adminPeerView)
	a.handleSignedIn("GET  /admin/peer/edit/", a._adminPeerEdit)
	a.handleSignedIn("POST /admin/peer/edit/", a._adminPeerEditSubmit)
	a.handleSignedIn("GET  /admin/peer/delete/", a._adminPeerDelete)
	a.handleSignedIn("POST /admin/peer/delete/", a._adminPeerDeleteSubmit)

	a.handleSignedIn("GET  /admin/password/edit/", a._adminPasswordEdit)
	a.handleSignedIn("POST /admin/password/edit/", a._adminPasswordSubmit)

	a.handlePeer("POST /peer/init/", a._peerInit)
	a.handlePeer("GET /peer/fetch-state/", a._peerFetchState)
}
