package areas

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

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

func AreaRoutes(v1 fiber.Router, u user.UserService, s area.AreaService) {
	ctrl := controller.NewAreaController(s)

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

	route.Get("/",m.RequirePermissions(m.P_AreaGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_AreaCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_AreaGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_AreaUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_AreaDeleteOne), ctrl.DeleteOne)
}
