package productionstandards

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

	rProductionStandard "gitlab.com/mbugroup/lti-api.git/internal/modules/master/production-standards/repositories"
	sProductionStandard "gitlab.com/mbugroup/lti-api.git/internal/modules/master/production-standards/services"

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

type ProductionStandardModule struct{}

func (ProductionStandardModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
	productionStandardRepo := rProductionStandard.NewProductionStandardRepository(db)
	productionStandardDetailRepo := rProductionStandard.NewProductionStandardDetailRepository(db)
	standardGrowthDetailRepo := rProductionStandard.NewStandardGrowthDetailRepository(db)
	userRepo := rUser.NewUserRepository(db)

	productionStandardService := sProductionStandard.NewProductionStandardService(
		productionStandardRepo,
		productionStandardDetailRepo,
		standardGrowthDetailRepo,
		validate,
	)
	userService := sUser.NewUserService(userRepo, validate)

	ProductionStandardRoutes(router, userService, productionStandardService)
}

