// Code generated by Wire. DO NOT EDIT.

//go:generate go run github.com/google/wire/cmd/wire
//+build !wireinject

package wire

import (
	"context"
	"github.com/google/wire"
	"gorm.io/gorm"
	controller2 "opencatd-open/internal/controller"
	controller3 "opencatd-open/internal/controller/proxy"
	"opencatd-open/internal/controller/team"
	"opencatd-open/internal/dao"
	service2 "opencatd-open/internal/service"
	"opencatd-open/internal/service/team"
	"opencatd-open/pkg/config"
	"sync"
)

// Injectors from wire.go:

// 初始化 TeamHandler
func InitTeamHandler(ctx context.Context, cfg *config.Config, db *gorm.DB) (*controller.Team, error) {
	userDAO := dao.NewUserDAO(db)
	userService := service.NewUserService(db, userDAO)
	tokenDAO := dao.NewTokenDAO(db)
	tokenService := service.NewTokenService(tokenDAO)
	apiKeyDAO := dao.NewApiKeyDAO(cfg, db)
	apiKeyService := service.NewApiKeyService(db, apiKeyDAO)
	usageDAO := dao.NewUsageDAO(cfg, db)
	dailyUsageDAO := dao.NewDailyUsageDAO(cfg, db)
	usageService := service.NewUsageService(ctx, cfg, db, usageDAO, dailyUsageDAO)
	team := controller.NewTeam(userService, tokenService, apiKeyService, usageService)
	return team, nil
}

func InitAPIHandler(ctx context.Context, cfg *config.Config, db *gorm.DB) (*controller2.Api, error) {
	userDAO := dao.NewUserDAO(db)
	userServiceImpl := service2.NewUserService(cfg, db, userDAO)
	tokenDAO := dao.NewTokenDAO(db)
	tokenServiceImpl := service2.NewTokenService(db, tokenDAO)
	apiKeyDAO := dao.NewApiKeyDAO(cfg, db)
	apiKeyServiceImpl := service2.NewApiKeyService(db, apiKeyDAO)
	webAuthnService, err := service2.NewWebAuthnService(cfg, db)
	if err != nil {
		return nil, err
	}
	usageService := service2.NewUsageService(ctx, cfg, db)
	api := controller2.NewApi(cfg, db, userServiceImpl, tokenServiceImpl, apiKeyServiceImpl, webAuthnService, usageService)
	return api, nil
}

func InitProxyHandler(ctx context.Context, cfg *config.Config, db *gorm.DB, wg *sync.WaitGroup) (*controller3.Proxy, error) {
	userDAO := dao.NewUserDAO(db)
	apiKeyDAO := dao.NewApiKeyDAO(cfg, db)
	tokenDAO := dao.NewTokenDAO(db)
	usageDAO := dao.NewUsageDAO(cfg, db)
	dailyUsageDAO := dao.NewDailyUsageDAO(cfg, db)
	proxy := controller3.NewProxy(ctx, cfg, db, wg, userDAO, apiKeyDAO, tokenDAO, usageDAO, dailyUsageDAO)
	return proxy, nil
}

// wire.go:

// 定义 provider set
var userSet = wire.NewSet(dao.NewUserDAO, wire.Bind(new(dao.UserRepository), new(*dao.UserDAO)), service.NewUserService)

var keySet = wire.NewSet(dao.NewApiKeyDAO, wire.Bind(new(dao.ApiKeyRepository), new(*dao.ApiKeyDAO)), service.NewApiKeyService)

var tokenSet = wire.NewSet(dao.NewTokenDAO, wire.Bind(new(dao.TokenRepository), new(*dao.TokenDAO)), service.NewTokenService)

var usageSet = wire.NewSet(dao.NewUsageDAO, wire.Bind(new(dao.UsageRepository), new(*dao.UsageDAO)), dao.NewDailyUsageDAO, wire.Bind(new(dao.DailyUsageRepository), new(*dao.DailyUsageDAO)), service.NewUsageService)

var repositorySet = wire.NewSet(dao.NewUserDAO, wire.Bind(new(dao.UserRepository), new(*dao.UserDAO)), dao.NewTokenDAO, wire.Bind(new(dao.TokenRepository), new(*dao.TokenDAO)), dao.NewApiKeyDAO, wire.Bind(new(dao.ApiKeyRepository), new(*dao.ApiKeyDAO)), dao.NewUsageDAO, wire.Bind(new(dao.UsageRepository), new(*dao.UsageDAO)), dao.NewDailyUsageDAO, wire.Bind(new(dao.DailyUsageRepository), new(*dao.DailyUsageDAO)))

var serviceSet = wire.NewSet(service2.NewUserService, service2.NewTokenService, service2.NewApiKeyService, service2.NewWebAuthnService, service2.NewUsageService)

var proxySet = wire.NewSet(dao.NewUserDAO, dao.NewApiKeyDAO, dao.NewTokenDAO, dao.NewUsageDAO, dao.NewDailyUsageDAO)
