// Code generated by Wire. DO NOT EDIT.

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

package main

import (
	"github.com/chaitin/panda-wiki/config"
	mq3 "github.com/chaitin/panda-wiki/handler/mq"
	"github.com/chaitin/panda-wiki/log"
	"github.com/chaitin/panda-wiki/mq"
	cache2 "github.com/chaitin/panda-wiki/repo/cache"
	ipdb2 "github.com/chaitin/panda-wiki/repo/ipdb"
	mq2 "github.com/chaitin/panda-wiki/repo/mq"
	pg2 "github.com/chaitin/panda-wiki/repo/pg"
	"github.com/chaitin/panda-wiki/store/cache"
	"github.com/chaitin/panda-wiki/store/ipdb"
	"github.com/chaitin/panda-wiki/store/pg"
	"github.com/chaitin/panda-wiki/store/rag"
	"github.com/chaitin/panda-wiki/store/s3"
	"github.com/chaitin/panda-wiki/usecase"
)

// Injectors from wire.go:

func createApp() (*App, error) {
	configConfig, err := config.NewConfig()
	if err != nil {
		return nil, err
	}
	logger := log.NewLogger(configConfig)
	mqConsumer, err := mq.NewMQConsumer(configConfig, logger)
	if err != nil {
		return nil, err
	}
	ragService, err := rag.NewRAGService(configConfig, logger)
	if err != nil {
		return nil, err
	}
	db, err := pg.NewDB(configConfig)
	if err != nil {
		return nil, err
	}
	nodeRepository := pg2.NewNodeRepository(db, logger)
	knowledgeBaseRepository := pg2.NewKnowledgeBaseRepository(db, configConfig, logger, ragService)
	conversationRepository := pg2.NewConversationRepository(db, logger)
	modelRepository := pg2.NewModelRepository(db, logger)
	promptRepo := pg2.NewPromptRepo(db, logger)
	llmUsecase := usecase.NewLLMUsecase(configConfig, ragService, conversationRepository, knowledgeBaseRepository, nodeRepository, modelRepository, promptRepo, logger)
	mqProducer, err := mq.NewMQProducer(configConfig, logger)
	if err != nil {
		return nil, err
	}
	ragRepository := mq2.NewRAGRepository(mqProducer)
	systemSettingRepo := pg2.NewSystemSettingRepo(db, logger)
	modelUsecase := usecase.NewModelUsecase(modelRepository, nodeRepository, ragRepository, ragService, logger, configConfig, knowledgeBaseRepository, systemSettingRepo)
	ragmqHandler, err := mq3.NewRAGMQHandler(mqConsumer, logger, ragService, nodeRepository, knowledgeBaseRepository, llmUsecase, modelUsecase)
	if err != nil {
		return nil, err
	}
	ragDocUpdateHandler, err := mq3.NewRagDocUpdateHandler(mqConsumer, logger, nodeRepository)
	if err != nil {
		return nil, err
	}
	cacheCache, err := cache.NewCache(configConfig)
	if err != nil {
		return nil, err
	}
	statRepository := pg2.NewStatRepository(db, cacheCache)
	appRepository := pg2.NewAppRepository(db, logger)
	ipdbIPDB, err := ipdb.NewIPDB(configConfig, logger)
	if err != nil {
		return nil, err
	}
	ipAddressRepo := ipdb2.NewIPAddressRepo(ipdbIPDB, logger)
	geoRepo := cache2.NewGeoCache(cacheCache, db, logger)
	authRepo := pg2.NewAuthRepo(db, logger, cacheCache)
	statUseCase := usecase.NewStatUseCase(statRepository, nodeRepository, conversationRepository, appRepository, ipAddressRepo, geoRepo, authRepo, knowledgeBaseRepository, logger)
	userRepository := pg2.NewUserRepository(db, logger)
	minioClient, err := s3.NewMinioClient(configConfig)
	if err != nil {
		return nil, err
	}
	nodeUsecase := usecase.NewNodeUsecase(nodeRepository, appRepository, ragRepository, userRepository, knowledgeBaseRepository, llmUsecase, ragService, logger, minioClient, modelRepository, authRepo, modelUsecase)
	cronHandler, err := mq3.NewStatCronHandler(logger, statRepository, statUseCase, nodeUsecase)
	if err != nil {
		return nil, err
	}
	mqHandlers := &mq3.MQHandlers{
		RAGMQHandler:        ragmqHandler,
		RagDocUpdateHandler: ragDocUpdateHandler,
		StatCronHandler:     cronHandler,
	}
	app := &App{
		MQConsumer:      mqConsumer,
		Config:          configConfig,
		MQHandlers:      mqHandlers,
		StatCronHandler: cronHandler,
	}
	return app, nil
}

// wire.go:

type App struct {
	MQConsumer      mq.MQConsumer
	Config          *config.Config
	MQHandlers      *mq3.MQHandlers
	StatCronHandler *mq3.CronHandler
}
