package our_service_content_images

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

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

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

var NewOurServiceContentImagesModule = fx.Options(
	// repository
	fx.Provide(repository.NewOurServiceContentImagesRepository),

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

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

	// router
	fx.Provide(NewOurServiceContentImagesRouter),
)

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

func (_i *OurServiceContentImagesRouter) RegisterOurServiceContentImagesRoutes() {
	imageController := _i.Controller.OurServiceContentImages

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