package server

import (
	"github.com/gin-contrib/gzip"
	"github.com/gin-gonic/gin"

	"scrum-solitare/src/handlers"
	"scrum-solitare/src/routes"
)

func NewRouter(pages *handlers.PageHandler, rooms *handlers.RoomAPIHandler) *gin.Engine {
	r := gin.New()
	r.Use(gin.Logger(), gin.Recovery())
	r.Use(gzip.Gzip(gzip.DefaultCompression))

	r.LoadHTMLGlob("src/templates/*.html")
	routes.Register(r, pages, rooms)

	return r
}
