package customers

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

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

func CustomerRoutes(v1 fiber.Router, u user.UserService, s customer.CustomerService) {
	ctrl := controller.NewCustomerController(s)

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

	route.Get("/",m.RequirePermissions(m.P_CustomerGetAll), ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_CustomerCreateOne), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_CustomerGetOne), ctrl.GetOne)
	route.Patch("/:id",m.RequirePermissions(m.P_CustomerUpdateOne), ctrl.UpdateOne)
	route.Delete("/:id",m.RequirePermissions(m.P_CustomerDeleteOne), ctrl.DeleteOne)
}
