package dashboards

import (
	"github.com/go-playground/validator/v10"
	"github.com/gofiber/fiber/v2"
	"gorm.io/gorm"

	commonRepo "gitlab.com/mbugroup/lti-api.git/internal/common/repository"
	commonService "gitlab.com/mbugroup/lti-api.git/internal/common/service"
	rDashboard "gitlab.com/mbugroup/lti-api.git/internal/modules/dashboards/repositories"
	sDashboard "gitlab.com/mbugroup/lti-api.git/internal/modules/dashboards/services"

	rUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/repositories"
	sUser "gitlab.com/mbugroup/lti-api.git/internal/modules/users/services"
)

type DashboardModule struct{}

func (DashboardModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
	dashboardRepo := rDashboard.NewDashboardRepository(db)
	hppCostRepo := commonRepo.NewHppCostRepository(db)
	userRepo := rUser.NewUserRepository(db)

	hppSvc := commonService.NewHppService(hppCostRepo)
	dashboardService := sDashboard.NewDashboardService(dashboardRepo, validate, hppSvc)
	userService := sUser.NewUserService(userRepo, validate)

	DashboardRoutes(router, userService, dashboardService)
}
