package cms_media

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

	"web-qudo-be/app/module/cms_media/controller"
	"web-qudo-be/app/module/cms_media/service"
)

type CmsMediaRouter struct {
	App  *fiber.App
	Ctrl *controller.CmsMediaController
}

var NewCmsMediaModule = fx.Options(
	fx.Provide(service.NewCmsMediaService),
	fx.Provide(controller.NewCmsMediaController),
	fx.Provide(NewCmsMediaRouter),
)

func NewCmsMediaRouter(app *fiber.App, ctrl *controller.CmsMediaController) *CmsMediaRouter {
	return &CmsMediaRouter{App: app, Ctrl: ctrl}
}

func (r *CmsMediaRouter) RegisterCmsMediaRoutes() {
	r.App.Route("/cms-media", func(router fiber.Router) {
		router.Get("/viewer/*", r.Ctrl.Viewer)
	})
}
