package nonstocks

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

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

func NonstockRoutes(v1 fiber.Router, u user.UserService, s nonstock.NonstockService) {
	ctrl := controller.NewNonstockController(s)

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

	route.Get("/",m.RequirePermissions(m.P_NonstocksGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_NonstocksCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_NonstocksGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_NonstocksUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_NonstocksDeleteOne), ctrl.DeleteOne)
}
