package api

import (
	"github.com/gofiber/fiber/v2"

	"wucher/internal/service"
	"wucher/internal/transport/http/handlers"
	"wucher/internal/transport/http/middleware"
)

func registerDULRoutes(
	v1 fiber.Router,
	dulHandler *handlers.DULHandler,
	eventsHandler *handlers.FileManagerEventsHandler,
	authMiddleware fiber.Handler,
	authSvc *service.AuthService,
) {
	dul := v1.Group("/dul", authMiddleware)
	dul.Get("/events", middleware.PermissionRequired(authSvc, "dul.read"), eventsHandler.Stream)
	dul.Post("/create", middleware.PermissionRequired(authSvc, "dul.create"), dulHandler.Create)
	dul.Get("/get-all", middleware.PermissionRequired(authSvc, "dul.read"), dulHandler.List)
	dul.Get("/get-all/dt", middleware.PermissionRequired(authSvc, "dul.read"), dulHandler.ListDatatable)
	dul.Get("/get/:id", middleware.PermissionRequired(authSvc, "dul.read"), dulHandler.Get)
	dul.Patch("/update/:id", middleware.PermissionRequired(authSvc, "dul.update"), dulHandler.Update)
	dul.Delete("/delete/:id", middleware.PermissionRequired(authSvc, "dul.delete"), dulHandler.Delete)
}
