package transfer_layings

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

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

func TransferLayingRoutes(v1 fiber.Router, u user.UserService, s transferLaying.TransferLayingService) {
	ctrl := controller.NewTransferLayingController(s)

	route := v1.Group("/transfer_layings")
	route.Use(m.Auth(u))
	// route.Get("/", m.Auth(u), ctrl.GetAll)
	// route.Post("/", m.Auth(u), ctrl.CreateOne)
	// route.Get("/:id", m.Auth(u), ctrl.GetOne)
	// route.Patch("/:id", m.Auth(u), ctrl.UpdateOne)
	// route.Delete("/:id", m.Auth(u), ctrl.DeleteOne)
	// route.Post("/approval", m.Auth(u), ctrl.Approval)

	route.Get("/", m.RequirePermissions(m.P_TransferToLaying_GetAll), ctrl.GetAll)
	route.Post("/", m.RequirePermissions(m.P_TransferToLaying_CreateOne), ctrl.CreateOne)
	route.Get("/:id", m.RequirePermissions(m.P_TransferToLaying_GetOne), ctrl.GetOne)
	route.Patch("/:id", m.RequirePermissions(m.P_TransferToLaying_UpdateOne), ctrl.UpdateOne)
	route.Delete("/:id", m.RequirePermissions(m.P_TransferToLaying_DeleteOne), ctrl.DeleteOne)
	route.Post("/approvals", m.RequirePermissions(m.P_TransferToLaying_Approval), ctrl.Approval)
	route.Post("/:id/execute", m.RequirePermissions(m.P_TransferToLaying_Approval), ctrl.Execute)
	route.Post("/:id/unexecute", m.RequirePermissions(m.P_TransferToLaying_Approval), ctrl.Unexecute)
	route.Get("/project-flocks/:project_flock_id/available-qty", m.RequirePermissions(m.P_TransferToLaying_GetAvailableQty), ctrl.GetAvailableQtyPerKandang)
	route.Get("/project-flocks/:project_flock_id/max-target-qty", m.RequirePermissions(m.P_TransferToLaying_CreateOne), ctrl.GetMaxTargetQtyPerKandang)
}
