package uoms

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

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

func UomRoutes(v1 fiber.Router, u user.UserService, s uom.UomService) {
	ctrl := controller.NewUomController(s)

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

	route.Get("/", m.RequirePermissions(m.P_UomsGetAll), ctrl.GetAll)
	route.Post("/", m.RequirePermissions(m.P_UomsCreateOne), ctrl.CreateOne)
	route.Get("/:id", m.RequirePermissions(m.P_UomsGetOne), ctrl.GetOne)
	route.Patch("/:id", m.RequirePermissions(m.P_UomsUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id", m.RequirePermissions(m.P_UomsDeleteOne), ctrl.DeleteOne)
}
