package flocks

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

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

func FlockRoutes(v1 fiber.Router, u user.UserService, s flock.FlockService) {
	ctrl := controller.NewFlockController(s)

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

	route.Get("/",m.RequirePermissions(m.P_FlocksGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_FlocksCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_FlocksGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_FlocksUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_FlocksDeleteOne), ctrl.DeleteOne)
}
