package our_product_content_images

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

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

type OurProductContentImagesRouter struct {
	App        fiber.Router
	Controller *controller.Controller
}

var NewOurProductContentImagesModule = fx.Options(
	// repository
	fx.Provide(repository.NewOurProductContentImagesRepository),

	// service
	fx.Provide(service.NewOurProductContentImagesService),

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

	// router
	fx.Provide(NewOurProductContentImagesRouter),
)

func NewOurProductContentImagesRouter(fiber *fiber.App, controller *controller.Controller) *OurProductContentImagesRouter {
	return &OurProductContentImagesRouter{
		App:        fiber,
		Controller: controller,
	}
}

func (_i *OurProductContentImagesRouter) RegisterOurProductContentImagesRoutes() {
	imageController := _i.Controller.OurProductContentImages

	_i.App.Route("/our-product-content-images", func(router fiber.Router) {
		router.Get("/:content_id", imageController.FindByOurProductContentID)
		router.Post("/", imageController.Save)
		router.Put("/:id", imageController.Update)
		router.Delete("/:id", imageController.Delete)
	})
}