package productWarehouses

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

	rProductWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/inventory/product-warehouses/repositories"
	sProductWarehouse "gitlab.com/mbugroup/lti-api.git/internal/modules/inventory/product-warehouses/services"
	rKandang "gitlab.com/mbugroup/lti-api.git/internal/modules/master/kandangs/repositories"

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

type ProductWarehouseModule struct{}

func (ProductWarehouseModule) RegisterRoutes(router fiber.Router, db *gorm.DB, validate *validator.Validate) {
	productWarehouseRepo := rProductWarehouse.NewProductWarehouseRepository(db)
	userRepo := rUser.NewUserRepository(db)
	kandangRepo := rKandang.NewKandangRepository(db)

	productWarehouseService := sProductWarehouse.NewProductWarehouseService(productWarehouseRepo, validate, kandangRepo)
	userService := sUser.NewUserService(userRepo, validate)

	ProductWarehouseRoutes(router, userService, productWarehouseService)
}
