package kandangs

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

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

func KandangRoutes(v1 fiber.Router, u user.UserService, s kandang.KandangService) {
	ctrl := controller.NewKandangController(s)

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

	route.Get("/",m.RequirePermissions(m.P_KandangsGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_KandangsCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_KandangsGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_KandangsUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_KandangsDeleteOne), ctrl.DeleteOne)
}
