package pay

import (
	"bindbox-game/internal/pkg/logger"
	"bindbox-game/internal/repository/mysql"
	"bindbox-game/internal/repository/mysql/dao"
	activitysvc "bindbox-game/internal/service/activity"
	snapshotsvc "bindbox-game/internal/service/snapshot"
	tasksvc "bindbox-game/internal/service/task_center"
	usersvc "bindbox-game/internal/service/user"
)

type handler struct {
	logger   logger.CustomLogger
	writeDB  *dao.Query
	readDB   *dao.Query
	user     usersvc.Service
	task     tasksvc.Service
	activity activitysvc.Service
	repo     mysql.Repo
	snapshot snapshotsvc.Service
}

func New(logger logger.CustomLogger, db mysql.Repo, taskSvc tasksvc.Service, activitySvc activitysvc.Service) *handler {
	userSvc := usersvc.New(logger, db)
	snapshotSvc := snapshotsvc.NewService(db)
	return &handler{
		logger:   logger,
		writeDB:  dao.Use(db.GetDbW()),
		readDB:   dao.Use(db.GetDbR()),
		user:     userSvc,
		task:     taskSvc,
		activity: activitySvc,
		repo:     db,
		snapshot: snapshotSvc,
	}
}
