package uniformitys

import (
	m "gitlab.com/mbugroup/lti-api.git/internal/middleware"
	controller "gitlab.com/mbugroup/lti-api.git/internal/modules/production/uniformities/controllers"
	uniformity "gitlab.com/mbugroup/lti-api.git/internal/modules/production/uniformities/services"
	user "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"

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

func UniformityRoutes(v1 fiber.Router, u user.UserService, s uniformity.UniformityService) {
	ctrl := controller.NewUniformityController(s)

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

	route.Get("/", m.RequirePermissions(m.P_Uniformities_GetAll), ctrl.GetAll)
	route.Post("/", m.RequirePermissions(m.P_Uniformities_CreateOne), ctrl.CreateOne)
	route.Post("/verify", m.RequirePermissions(m.P_Uniformities_Verify), ctrl.UploadBodyWeightExcel)
	route.Post("/approvals", m.RequirePermissions(m.P_Uniformities_Approval), ctrl.Approve)
	route.Get("/:id", m.RequirePermissions(m.P_Uniformities_GetOne), ctrl.GetOne)
	route.Patch("/:id", m.RequirePermissions(m.P_Uniformities_UpdateOne), ctrl.UpdateOne)
	route.Delete("/:id", m.RequirePermissions(m.P_Uniformities_DeleteOne), ctrl.DeleteOne)
}
