// Code generated by Wire. DO NOT EDIT.

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

package server

import (
	"github.com/authgear/authgear-server/pkg/lib/config/configsource"
	"github.com/authgear/authgear-server/pkg/lib/deps"
	"github.com/authgear/authgear-server/pkg/lib/infra/db/globaldb"
	"github.com/authgear/authgear-server/pkg/util/clock"
)

// Injectors from wire.go:

func newConfigSourceController(p *deps.RootProvider) *configsource.Controller {
	config := p.ConfigSourceConfig
	manager := p.BaseResources
	localFS := &configsource.LocalFS{
		BaseResources: manager,
		Config:        config,
	}
	environmentConfig := p.EnvironmentConfig
	trustProxy := environmentConfig.TrustProxy
	clock := _wireSystemClockValue
	globalDatabaseCredentialsEnvironmentConfig := &environmentConfig.GlobalDatabase
	sqlBuilder := globaldb.NewSQLBuilder(globalDatabaseCredentialsEnvironmentConfig)
	configSourceStoreFactory := configsource.NewConfigSourceStoreStoreFactory(sqlBuilder)
	planStoreFactory := configsource.NewPlanStoreStoreFactory(sqlBuilder)
	pool := p.DatabasePool
	databaseEnvironmentConfig := &environmentConfig.DatabaseConfig
	databaseHandleFactory := configsource.NewDatabaseHandleFactory(pool, globalDatabaseCredentialsEnvironmentConfig, databaseEnvironmentConfig)
	resolveAppIDType := configsource.NewResolveAppIDTypeDomain()
	database := &configsource.Database{
		BaseResources:            manager,
		TrustProxy:               trustProxy,
		Config:                   config,
		Clock:                    clock,
		ConfigSourceStoreFactory: configSourceStoreFactory,
		PlanStoreFactory:         planStoreFactory,
		DatabaseHandleFactory:    databaseHandleFactory,
		DatabaseCredentials:      globalDatabaseCredentialsEnvironmentConfig,
		DatabaseConfig:           databaseEnvironmentConfig,
		ResolveAppIDType:         resolveAppIDType,
	}
	controller := configsource.NewController(config, localFS, database)
	return controller
}

var (
	_wireSystemClockValue = clock.NewSystemClock()
)
