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

import (
	"github.com/emochka2007/block-accounting/internal/pkg/config"
	"github.com/emochka2007/block-accounting/internal/service"
	"github.com/emochka2007/block-accounting/internal/usecase/repository"
)

// Injectors from wire.go:

func ProvideService(c config.Config) (service.Service, func(), error) {
	logger := provideLogger(c)
	db, cleanup, err := repository.ProvideDatabaseConnection(c)
	if err != nil {
		return nil, nil, err
	}
	usersRepository := provideUsersRepository(db)
	organizationsRepository := provideOrganizationsRepository(db, usersRepository)
	transactionsRepository := provideTxRepository(db, organizationsRepository)
	chainInteractor := provideChainInteractor(logger, c, transactionsRepository)
	usersInteractor := provideUsersInteractor(logger, usersRepository, chainInteractor)
	authRepository := provideAuthRepository(db)
	jwtInteractor := provideJWTInteractor(c, usersInteractor, authRepository)
	authPresenter := provideAuthPresenter(jwtInteractor)
	client, cleanup2 := provideRedisConnection(c)
	cache := provideRedisCache(client, logger)
	organizationsInteractor := provideOrganizationsInteractor(logger, organizationsRepository, cache)
	authController := provideAuthController(logger, usersInteractor, authPresenter, jwtInteractor, authRepository, organizationsInteractor)
	organizationsPresenter := provideOrganizationsPresenter()
	organizationsController := provideOrganizationsController(logger, organizationsInteractor, organizationsPresenter)
	transactionsInteractor := provideTxInteractor(logger, transactionsRepository, organizationsInteractor, chainInteractor)
	transactionsController := provideTxController(logger, transactionsInteractor, chainInteractor, organizationsInteractor)
	participantsController := provideParticipantsController(logger, organizationsInteractor, usersInteractor)
	rootController := provideControllers(logger, authController, organizationsController, transactionsController, participantsController)
	server := provideRestServer(logger, rootController, c, jwtInteractor)
	serviceService := service.NewService(logger, server)
	return serviceService, func() {
		cleanup2()
		cleanup()
	}, nil
}
