package popup_news_content_images

import (
	"web-qudo-be/app/module/popup_news_content_images/controller"
	"web-qudo-be/app/module/popup_news_content_images/repository"
	"web-qudo-be/app/module/popup_news_content_images/service"

	"github.com/gofiber/fiber/v2"
	"go.uber.org/fx"
)

// struct of PopupNewsContentImagesRouter
type PopupNewsContentImagesRouter struct {
	App        fiber.Router
	Controller *controller.Controller
}

// register bulky of module
var NewPopupNewsContentImagesModule = fx.Options(
	// register repository
	fx.Provide(repository.NewPopupNewsContentImagesRepository),

	// register service
	fx.Provide(service.NewPopupNewsContentImagesService),

	// register controller
	fx.Provide(controller.NewController),

	// register router
	fx.Provide(NewPopupNewsContentImagesRouter),
)

// init router
func NewPopupNewsContentImagesRouter(fiber *fiber.App, controller *controller.Controller) *PopupNewsContentImagesRouter {
	return &PopupNewsContentImagesRouter{
		App:        fiber,
		Controller: controller,
	}
}

// register routes
func (_i *PopupNewsContentImagesRouter) RegisterPopupNewsContentImagesRoutes() {
	popupNewsContentImagesController := _i.Controller.PopupNewsContent

	_i.App.Route("/popup-news-content-images", func(router fiber.Router) {
	
		router.Post("/", popupNewsContentImagesController.Save)
	
		router.Delete("/:id", popupNewsContentImagesController.Delete)
	})
}