// Code generated by Wire. DO NOT EDIT.

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

package graphql_resolver

import (
	"github.com/aristat/golang-example-app/app/casbin"
	"github.com/aristat/golang-example-app/app/config"
	"github.com/aristat/golang-example-app/app/db"
	"github.com/aristat/golang-example-app/app/db/repo"
	"github.com/aristat/golang-example-app/app/entrypoint"
	"github.com/aristat/golang-example-app/app/grpc"
	"github.com/aristat/golang-example-app/app/logger"
	"github.com/aristat/golang-example-app/app/tracing"
	"github.com/aristat/golang-example-app/generated/graphql"
)

// Injectors from injector.go:

// Build
func Build() (graphql.Config, func(), error) {
	context, cleanup, err := entrypoint.ContextProvider()
	if err != nil {
		return graphql.Config{}, nil, err
	}
	viper, cleanup2, err := config.Provider()
	if err != nil {
		cleanup()
		return graphql.Config{}, nil, err
	}
	loggerConfig, cleanup3, err := logger.ProviderCfg(viper)
	if err != nil {
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	zap, cleanup4, err := logger.Provider(context, loggerConfig)
	if err != nil {
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	graphql_resolverConfig, cleanup5, err := Cfg(viper)
	if err != nil {
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	enforcer, cleanup6, err := casbin.Provider()
	if err != nil {
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	dbConfig, cleanup7, err := db.Cfg(viper)
	if err != nil {
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	gormDB, cleanup8, err := db.ProviderGORM(context, zap, dbConfig)
	if err != nil {
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	usersRepo, cleanup9, err := repo.NewUsersRepo(gormDB)
	if err != nil {
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	repoRepo, cleanup10, err := repo.Provider(usersRepo)
	if err != nil {
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	configuration, cleanup11, err := tracing.Cfg(viper)
	if err != nil {
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	tracerProvider, cleanup12, err := tracing.Provider(context, configuration, zap)
	if err != nil {
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	grpcConfig, cleanup13, err := grpc.Cfg(viper)
	if err != nil {
		cleanup12()
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	poolManager, cleanup14, err := grpc.Provider(context, tracerProvider, zap, grpcConfig)
	if err != nil {
		cleanup13()
		cleanup12()
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	managers := Managers{
		Repo:        repoRepo,
		PollManager: poolManager,
	}
	graphqlConfig, cleanup15, err := Provider(context, zap, graphql_resolverConfig, enforcer, managers)
	if err != nil {
		cleanup14()
		cleanup13()
		cleanup12()
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	return graphqlConfig, func() {
		cleanup15()
		cleanup14()
		cleanup13()
		cleanup12()
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
	}, nil
}

func BuildTest() (graphql.Config, func(), error) {
	context, cleanup, err := entrypoint.ContextProviderTest()
	if err != nil {
		return graphql.Config{}, nil, err
	}
	loggerConfig, cleanup2, err := logger.ProviderCfgTest()
	if err != nil {
		cleanup()
		return graphql.Config{}, nil, err
	}
	mock, cleanup3, err := logger.ProviderTest(context, loggerConfig)
	if err != nil {
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	graphql_resolverConfig, cleanup4, err := CfgTest()
	if err != nil {
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	enforcer, cleanup5, err := casbin.ProviderTest()
	if err != nil {
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	gormDB, cleanup6, err := db.ProviderGORMTest()
	if err != nil {
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	usersRepo, cleanup7, err := repo.NewUsersRepo(gormDB)
	if err != nil {
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	repoRepo, cleanup8, err := repo.Provider(usersRepo)
	if err != nil {
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	tracerProvider, cleanup9, err := tracing.ProviderTest()
	if err != nil {
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	grpcConfig, cleanup10, err := grpc.CfgTest()
	if err != nil {
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	poolManager, cleanup11, err := grpc.Provider(context, tracerProvider, mock, grpcConfig)
	if err != nil {
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	managers := Managers{
		Repo:        repoRepo,
		PollManager: poolManager,
	}
	graphqlConfig, cleanup12, err := Provider(context, mock, graphql_resolverConfig, enforcer, managers)
	if err != nil {
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
		return graphql.Config{}, nil, err
	}
	return graphqlConfig, func() {
		cleanup12()
		cleanup11()
		cleanup10()
		cleanup9()
		cleanup8()
		cleanup7()
		cleanup6()
		cleanup5()
		cleanup4()
		cleanup3()
		cleanup2()
		cleanup()
	}, nil
}
