package app

import (
    "bindbox-game/internal/pkg/logger"
    "bindbox-game/internal/repository/mysql"
    "bindbox-game/internal/repository/mysql/dao"
    activitysvc "bindbox-game/internal/service/activity"
    syscfgsvc "bindbox-game/internal/service/sysconfig"
    usersvc "bindbox-game/internal/service/user"
)

type handler struct {
    logger   logger.CustomLogger
    writeDB  *dao.Query
    readDB   *dao.Query
    activity activitysvc.Service
    syscfg   syscfgsvc.Service
    repo     mysql.Repo
    user     usersvc.Service
}

func New(logger logger.CustomLogger, db mysql.Repo) *handler {
    return &handler{
        logger:   logger,
        writeDB:  dao.Use(db.GetDbW()),
        readDB:   dao.Use(db.GetDbR()),
        activity: activitysvc.New(logger, db),
        syscfg:   syscfgsvc.New(logger, db),
        repo:     db,
        user:     usersvc.New(logger, db),
    }
}
