package locations

import (
	m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
	controller "gitlab.com/mbugroup/lti-api.git/internal/modules/master/locations/controllers"
	location "gitlab.com/mbugroup/lti-api.git/internal/modules/master/locations/services"
	user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"

	"github.com/gofiber/fiber/v2"
)

func LocationRoutes(v1 fiber.Router, u user.UserService, s location.LocationService) {
	ctrl := controller.NewLocationController(s)

	route := v1.Group("/locations")
	route.Use(m.Auth(u))

	route.Get("/",m.RequirePermissions(m.P_LocationsGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_LocationsCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_LocationsGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_LocationsUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_LocationsDeleteOne), ctrl.DeleteOne)
}
