package api

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

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

func registerHelicopterFileRoutes(
	v1 fiber.Router,
	handler *handlers.HelicopterFileHandler,
	eventsHandler *handlers.HelicopterFileEventsHandler,
	authMiddleware fiber.Handler,
	authSvc *service.AuthService,
) {
	files := v1.Group("/helicopter-files", authMiddleware)
	files.Get("/events", middleware.PermissionRequired(authSvc, "helicopter.read"), eventsHandler.Stream)
	files.Post("/upload", middleware.PermissionRequired(authSvc, "helicopter.update"), handler.Upload)
	files.Post("/cancel-upload", middleware.PermissionRequired(authSvc, "helicopter.update"), handler.CancelUpload)
	files.Post("/create", middleware.PermissionRequired(authSvc, "helicopter.update"), handler.Create)
	files.Get("/get-all", middleware.PermissionRequired(authSvc, "helicopter.read"), handler.List)
	files.Get("/get/:helicopter_id", middleware.PermissionRequired(authSvc, "helicopter.read"), handler.Get)
	files.Patch("/update", middleware.PermissionRequired(authSvc, "helicopter.update"), handler.Update)
	files.Delete("/delete", middleware.PermissionRequired(authSvc, "helicopter.delete"), handler.Delete)
}
