// Code generated by Wire. DO NOT EDIT.

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

package main

import (
	"github.com/GoYoko/web"
	"github.com/chaitin/MonkeyCode/backend/config"
	"github.com/chaitin/MonkeyCode/backend/db"
	"github.com/chaitin/MonkeyCode/backend/domain"
	v1_5 "github.com/chaitin/MonkeyCode/backend/internal/billing/handler/http/v1"
	repo6 "github.com/chaitin/MonkeyCode/backend/internal/billing/repo"
	usecase5 "github.com/chaitin/MonkeyCode/backend/internal/billing/usecase"
	v1_4 "github.com/chaitin/MonkeyCode/backend/internal/dashboard/handler/v1"
	repo5 "github.com/chaitin/MonkeyCode/backend/internal/dashboard/repo"
	usecase4 "github.com/chaitin/MonkeyCode/backend/internal/dashboard/usecase"
	"github.com/chaitin/MonkeyCode/backend/internal/middleware"
	v1_2 "github.com/chaitin/MonkeyCode/backend/internal/model/handler/http/v1"
	repo3 "github.com/chaitin/MonkeyCode/backend/internal/model/repo"
	usecase2 "github.com/chaitin/MonkeyCode/backend/internal/model/usecase"
	"github.com/chaitin/MonkeyCode/backend/internal/openai/handler/v1"
	repo2 "github.com/chaitin/MonkeyCode/backend/internal/openai/repo"
	"github.com/chaitin/MonkeyCode/backend/internal/openai/usecase"
	"github.com/chaitin/MonkeyCode/backend/internal/proxy"
	"github.com/chaitin/MonkeyCode/backend/internal/proxy/repo"
	"github.com/chaitin/MonkeyCode/backend/internal/proxy/usecase"
	v1_3 "github.com/chaitin/MonkeyCode/backend/internal/user/handler/v1"
	repo4 "github.com/chaitin/MonkeyCode/backend/internal/user/repo"
	usecase3 "github.com/chaitin/MonkeyCode/backend/internal/user/usecase"
	"github.com/chaitin/MonkeyCode/backend/pkg"
	"github.com/chaitin/MonkeyCode/backend/pkg/logger"
	"github.com/chaitin/MonkeyCode/backend/pkg/session"
	"github.com/chaitin/MonkeyCode/backend/pkg/store"
	"log/slog"
)

// Injectors from wire.go:

func newServer(dir string) (*Server, error) {
	configConfig, err := config.Init(dir)
	if err != nil {
		return nil, err
	}
	web := pkg.NewWeb(configConfig)
	loggerConfig := configConfig.Logger
	slogLogger := logger.NewLogger(loggerConfig)
	client, err := store.NewEntDB(configConfig, slogLogger)
	if err != nil {
		return nil, err
	}
	proxyRepo := repo.NewProxyRepo(client)
	proxyUsecase := usecase.NewProxyUsecase(proxyRepo)
	domainProxy := proxy.NewLLMProxy(proxyUsecase, configConfig, slogLogger)
	openAIRepo := repo2.NewOpenAIRepo(client)
	openAIUsecase := openai.NewOpenAIUsecase(configConfig, openAIRepo, slogLogger)
	proxyMiddleware := middleware.NewProxyMiddleware(proxyUsecase)
	v1Handler := v1.NewV1Handler(slogLogger, web, domainProxy, openAIUsecase, proxyMiddleware)
	modelRepo := repo3.NewModelRepo(client)
	modelUsecase := usecase2.NewModelUsecase(slogLogger, modelRepo, configConfig)
	sessionSession := session.NewSession(configConfig)
	authMiddleware := middleware.NewAuthMiddleware(sessionSession, slogLogger)
	modelHandler := v1_2.NewModelHandler(web, modelUsecase, authMiddleware, slogLogger)
	redisClient := store.NewRedisCli(configConfig)
	userRepo := repo4.NewUserRepo(client)
	userUsecase := usecase3.NewUserUsecase(configConfig, redisClient, userRepo, slogLogger)
	userHandler := v1_3.NewUserHandler(web, userUsecase, authMiddleware, sessionSession, slogLogger, configConfig)
	dashboardRepo := repo5.NewDashboardRepo(client)
	dashboardUsecase := usecase4.NewDashboardUsecase(dashboardRepo)
	dashboardHandler := v1_4.NewDashboardHandler(web, dashboardUsecase, authMiddleware)
	billingRepo := repo6.NewBillingRepo(client)
	billingUsecase := usecase5.NewBillingUsecase(billingRepo)
	billingHandler := v1_5.NewBillingHandler(web, billingUsecase, authMiddleware)
	server := &Server{
		config:      configConfig,
		web:         web,
		ent:         client,
		logger:      slogLogger,
		proxy:       domainProxy,
		openaiV1:    v1Handler,
		modelV1:     modelHandler,
		userV1:      userHandler,
		dashboardV1: dashboardHandler,
		billingV1:   billingHandler,
	}
	return server, nil
}

// wire.go:

type Server struct {
	config      *config.Config
	web         *web.Web
	ent         *db.Client
	logger      *slog.Logger
	proxy       domain.Proxy
	openaiV1    *v1.V1Handler
	modelV1     *v1_2.ModelHandler
	userV1      *v1_3.UserHandler
	dashboardV1 *v1_4.DashboardHandler
	billingV1   *v1_5.BillingHandler
}
