package products

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

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

func ProductRoutes(v1 fiber.Router, u user.UserService, s product.ProductService) {
	ctrl := controller.NewProductController(s)

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

	route.Get("/",m.RequirePermissions(m.P_ProductsGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_ProductsCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_ProductsGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_ProductsUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_ProductsDeleteOne), ctrl.DeleteOne)
}
