package warehouses

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

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

func WarehouseRoutes(v1 fiber.Router, u user.UserService, s warehouse.WarehouseService) {
	ctrl := controller.NewWarehouseController(s)

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

	route.Get("/",m.RequirePermissions(m.P_WarehousesGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_WarehousesCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_WarehousesGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_WarehousesUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_WarehousesDeleteOne), ctrl.DeleteOne)
}
