package suppliers

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

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

func SupplierRoutes(v1 fiber.Router, u user.UserService, s supplier.SupplierService) {
	ctrl := controller.NewSupplierController(s)

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

	route.Get("/",m.RequirePermissions(m.P_SuppliersGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_SuppliersCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_SuppliersGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_SuppliersUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_SuppliersDeleteOne), ctrl.DeleteOne)
}
