// 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 provider

import (
	controller2 "github.com/echochat/backend/app/admin/controller"
	dao2 "github.com/echochat/backend/app/admin/dao"
	service2 "github.com/echochat/backend/app/admin/service"
	"github.com/echochat/backend/app/auth/controller"
	"github.com/echochat/backend/app/auth/dao"
	"github.com/echochat/backend/app/auth/service"
	controller3 "github.com/echochat/backend/app/contact/controller"
	dao3 "github.com/echochat/backend/app/contact/dao"
	service4 "github.com/echochat/backend/app/contact/service"
	controller4 "github.com/echochat/backend/app/file/controller"
	service5 "github.com/echochat/backend/app/file/service"
	controller5 "github.com/echochat/backend/app/group/controller"
	dao4 "github.com/echochat/backend/app/group/dao"
	service6 "github.com/echochat/backend/app/group/service"
	"github.com/echochat/backend/app/im"
	controller7 "github.com/echochat/backend/app/meeting/controller"
	dao6 "github.com/echochat/backend/app/meeting/dao"
	service7 "github.com/echochat/backend/app/meeting/service"
	task2 "github.com/echochat/backend/app/meeting/task"
	controller6 "github.com/echochat/backend/app/notify/controller"
	dao5 "github.com/echochat/backend/app/notify/dao"
	service3 "github.com/echochat/backend/app/notify/service"
	"github.com/echochat/backend/app/notify/task"
	controller8 "github.com/echochat/backend/app/transcribe/controller"
	dao7 "github.com/echochat/backend/app/transcribe/dao"
	service8 "github.com/echochat/backend/app/transcribe/service"
	"github.com/echochat/backend/app/ws"
	"github.com/echochat/backend/config"
	"github.com/echochat/backend/pkg/db"
	"github.com/echochat/backend/pkg/storage"
)

// Injectors from wire.go:

// InitializeApp 初始化整个应用（Wire 自动生成实现）
func InitializeApp(cfg *config.Config) (*App, error) {
	databaseConfig := provideDBConfig(cfg)
	gormDB, err := db.NewPostgres(databaseConfig)
	if err != nil {
		return nil, err
	}
	redisConfig := provideRedisConfig(cfg)
	client, err := db.NewRedis(redisConfig)
	if err != nil {
		return nil, err
	}
	minioConfig := provideMinioConfig(cfg)
	minioClient, err := storage.NewMinioClient(minioConfig)
	if err != nil {
		return nil, err
	}
	userDAO := dao.NewUserDAO(gormDB)
	roleDAO := dao.NewRoleDAO(gormDB)
	oauthAccountDAO := dao.NewOAuthAccountDAO(gormDB)
	jwtConfig := provideJWTConfig(cfg)
	tokenStore := service.NewTokenStore(client, jwtConfig)
	authService := service.NewAuthService(userDAO, roleDAO, jwtConfig, tokenStore)
	oauthConfig := provideOAuthConfig(cfg)
	oauthService := service.NewOAuthService(userDAO, oauthAccountDAO, roleDAO, authService, oauthConfig, client)
	authController := controller.NewAuthController(authService, oauthService, oauthConfig)
	adminAuthController := controller.NewAdminAuthController(authService)
	userManageDAO := dao2.NewUserManageDAO(gormDB)
	userManageService := service2.NewUserManageService(userManageDAO, userDAO, roleDAO)
	userManageController := controller2.NewUserManageController(userManageService)
	hub := ws.ProvideHub()
	pubSub := ws.ProvidePubSub(client, hub)
	friendshipDAO := dao3.NewFriendshipDAO(gormDB)
	onlineService := ws.ProvideOnlineService(client, hub, pubSub, friendshipDAO)
	onlineManageService := service2.NewOnlineManageService(onlineService, gormDB)
	onlineController := controller2.NewOnlineController(onlineManageService)
	contactManageService := service2.NewContactManageService(gormDB)
	contactManageController := controller2.NewContactManageController(contactManageService)
	groupDAO := dao4.NewGroupDAO(gormDB)
	groupManageService := service2.NewGroupManageService(gormDB, groupDAO)
	groupManageController := controller2.NewGroupManageController(groupManageService)
	messageManageDAO := dao2.NewMessageManageDAO(gormDB)
	conversationDAO := im.ProvideConversationDAO(gormDB)
	messageManageService := service2.NewMessageManageService(messageManageDAO, userDAO, conversationDAO, pubSub)
	messageManageController := controller2.NewMessageManageController(messageManageService)
	meetingManageDAO := dao2.NewMeetingManageDAO(gormDB)
	// admin meetingManageService 依赖 meetingRecordingService（强制结束录制兜底），延后到 meetingRecordingService 构造后再实例化
	serverConfig := provideServerConfig(cfg)
	handler := ws.ProvideWSHandler(hub, pubSub, jwtConfig, serverConfig, onlineService, authService)
	friendGroupDAO := dao3.NewFriendGroupDAO(gormDB)
	notificationDAO := dao5.NewNotificationDAO(gormDB)
	notifyService := service3.NewNotifyService(notificationDAO, pubSub, friendshipDAO)
	contactService := service4.NewContactService(friendshipDAO, friendGroupDAO, onlineService, notifyService)
	contactController := controller3.NewContactController(contactService)
	messageDAO := im.ProvideMessageDAO(gormDB)
	messageReadDAO := dao4.NewMessageReadDAO(gormDB)
	imService := im.ProvideIMService(conversationDAO, messageDAO, pubSub, client, friendshipDAO, friendshipDAO, groupDAO, messageReadDAO)
	imController := im.ProvideIMController(imService)
	eventHandler := im.ProvideIMEventHandler(imService, hub)
	offlinePusher := im.ProvideOfflinePusher(imService, conversationDAO, pubSub)
	fileService := service5.NewFileService(minioClient, minioConfig)
	fileController := controller4.NewFileController(fileService)
	joinRequestDAO := dao4.NewJoinRequestDAO(gormDB)
	groupService := service6.NewGroupService(groupDAO, joinRequestDAO, friendshipDAO, pubSub, messageDAO, notifyService)
	groupController := controller5.NewGroupController(groupService)
	notificationController := controller6.NewNotificationController(notifyService)
	cleanupTask := task.NewCleanupTask(notificationDAO)
	meetingRoomDAO := dao6.NewMeetingRoomDAO(gormDB)
	meetingParticipantDAO := dao6.NewMeetingParticipantDAO(gormDB)
	meetingChatDAO := dao6.NewMeetingChatDAO(gormDB)
	meetingRecordingDAO := dao6.NewMeetingRecordingDAO(gormDB)
	meetingBroadcaster := service7.NewMeetingBroadcaster(meetingParticipantDAO, pubSub)
	httpMediaOrchestrator := service7.NewHTTPMediaOrchestrator(cfg, client)
	meetingConfig := provideMeetingConfig(cfg)
	meetingLifecycleService := service7.NewMeetingLifecycleService(meetingRoomDAO, meetingParticipantDAO, client, meetingBroadcaster, httpMediaOrchestrator, cfg)
	meetingService := service7.NewMeetingService(meetingRoomDAO, meetingParticipantDAO, meetingChatDAO, gormDB, client, meetingBroadcaster, notifyService, friendshipDAO, onlineService, httpMediaOrchestrator, meetingLifecycleService)
	meetingSignalService := service7.NewMeetingSignalService(meetingRoomDAO, meetingParticipantDAO, client, meetingBroadcaster, httpMediaOrchestrator, meetingLifecycleService)
	meetingRecordingService := service7.NewMeetingRecordingService(meetingRoomDAO, meetingParticipantDAO, meetingRecordingDAO, client, meetingBroadcaster, httpMediaOrchestrator, minioClient, minioConfig, meetingConfig)
	// admin 会议管理服务在 recording service 构造后再创建，从而支持"强制结束录制"兜底
	meetingManageService := service2.NewMeetingManageService(meetingManageDAO, meetingRecordingService)
	meetingManageController := controller2.NewMeetingManageController(meetingManageService)
	meetingController := controller7.NewMeetingController(meetingService, meetingConfig, authService)
	meetingRecordingController := controller7.NewMeetingRecordingController(meetingRecordingService, meetingConfig)
	meetingWSHandler := controller7.NewMeetingWSHandler(meetingSignalService, hub)
	meetingCleanupTask := task2.NewMeetingCleanupTask(meetingLifecycleService, meetingRoomDAO, meetingChatDAO)
	llmSourceConfig := provideLLMSourceConfig(cfg)
	llmSourceDB, err := db.NewLLMSourceDB(llmSourceConfig)
	if err != nil {
		return nil, err
	}
	transcriptDAO := dao7.NewTranscriptDAO(gormDB)
	llmConfigDAO := dao7.NewLLMConfigDAO(llmSourceDB)
	sttClient := service8.NewOpenAICompatibleClient()
	transcribeService := service8.NewTranscribeService(gormDB, transcriptDAO, llmConfigDAO, sttClient)
	transcribeController := controller8.NewTranscribeController(transcribeService)
	app := NewApp(cfg, gormDB, client, minioClient, authService, authController, adminAuthController, userManageController, onlineController, contactManageController, groupManageController, messageManageController, meetingManageController, handler, hub, pubSub, onlineService, contactController, imController, eventHandler, offlinePusher, fileController, groupController, notifyService, notificationController, cleanupTask, meetingService, meetingSignalService, meetingLifecycleService, meetingController, meetingRecordingController, meetingRecordingService, meetingWSHandler, meetingCleanupTask, transcribeController, llmSourceDB)
	return app, nil
}
