package router
 
import (
	"net/http"
 
	"github.com/go-chi/chi/v5"
	"github.com/mkappworks-dev/cloudzilla-app/internal/handler"
)
 
// New returns a chi router with all Cloudzilla routes registered.
func New(h *handler.Handlers) http.Handler {
	r := chi.NewRouter()
 
	r.Get("/", h.Home)
	r.Get("/explore", h.Explore)
 
	r.Route("/{owner}/{repo}", func(r chi.Router) {
		r.Get("/", h.PageRepo)
		r.Get("/tree/*", h.PageTree)
		r.Get("/blob/*", h.PageBlob)
		r.Get("/blame/*", h.PageBlame)
		r.Get("/commits/*", h.PageCommits)
		r.Get("/pulse", h.PagePulse)
	})
 
	return r
}