package admin

import (
    "bindbox-game/internal/pkg/logger"
    "bindbox-game/internal/repository/mysql"
    "bindbox-game/internal/repository/mysql/dao"
    activitysvc "bindbox-game/internal/service/activity"
    adminsvc "bindbox-game/internal/service/admin"
    guildsvc "bindbox-game/internal/service/guild"
    productsvc "bindbox-game/internal/service/product"
    bannersvc "bindbox-game/internal/service/banner"
    usersvc "bindbox-game/internal/service/user"
)

type handler struct {
    logger   logger.CustomLogger
    writeDB  *dao.Query
    readDB   *dao.Query
    svc      adminsvc.Service
    activity activitysvc.Service
    guild    guildsvc.Service
    product  productsvc.Service
    user     usersvc.Service
    banner   bannersvc.Service
}

func New(logger logger.CustomLogger, db mysql.Repo) *handler {
    return &handler{
        logger:   logger,
        writeDB:  dao.Use(db.GetDbW()),
        readDB:   dao.Use(db.GetDbR()),
        svc:      adminsvc.New(logger, db),
        activity: activitysvc.New(logger, db),
        guild:    guildsvc.New(logger, db),
        product:  productsvc.New(logger, db),
        user:     usersvc.New(logger, db),
        banner:   bannersvc.New(logger, db),
    }
}
