package kandanggroups

import (
	"github.com/gofiber/fiber/v2"

	m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
	controller "gitlab.com/mbugroup/lti-api.git/internal/modules/master/kandang-groups/controllers"
	kandanggroup "gitlab.com/mbugroup/lti-api.git/internal/modules/master/kandang-groups/services"
	user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
)

func KandangGroupRoutes(v1 fiber.Router, u user.UserService, s kandanggroup.KandangGroupService) {
	ctrl := controller.NewKandangGroupController(s)

	route := v1.Group("/kandang-groups")
	route.Use(m.Auth(u))

	route.Get("/", ctrl.GetAll)
	route.Post("/", m.RequirePermissions(m.P_KandangGroups), ctrl.CreateOne)
	route.Get("/:id", m.RequirePermissions(m.P_KandangGroups), ctrl.GetOne)
	route.Patch("/:id", m.RequirePermissions(m.P_KandangGroups), ctrl.UpdateOne)
	route.Delete("/:id", m.RequirePermissions(m.P_KandangGroups), ctrl.DeleteOne)
}
