package project_flocks

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

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

func ProjectflockRoutes(v1 fiber.Router, u user.UserService, s projectflock.ProjectflockService) {
	ctrl := controller.NewProjectflockController(s)

	route := v1.Group("/project-flocks")
	route.Use(m.Auth(u))

	route.Get("/",m.RequirePermissions(m.P_ProjectFlockGetAll),ctrl.GetAll)
	route.Post("/",m.RequirePermissions(m.P_ProjectFlockCreate), ctrl.CreateOne)
	route.Get("/:id",m.RequirePermissions(m.P_ProjectFlockGetOne), ctrl.GetOne)
	route.Delete("/:id",m.RequirePermissions(m.P_ProjectFlockGetAll), ctrl.DeleteOne)
	route.Get("/kandangs/lookup",m.RequirePermissions(m.P_ProjectFlockLookup), ctrl.LookupProjectFlockKandang)
	route.Post("/approvals",m.RequirePermissions(m.P_ProjectFlockApprove), ctrl.Approval)
	route.Get("/locations/:location_id/periods",m.RequirePermissions(m.P_ProjectFlockNextPeriod), ctrl.GetPeriodSummary)
	route.Put("/:id/resubmit",m.RequirePermissions(m.P_ProjectFlockResubmit), ctrl.Resubmit)

}
