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

import (
	"github.com/cloudcarver/anclax/pkg/app"
	"github.com/cloudcarver/anclax/pkg/asynctask"
	"github.com/cloudcarver/anclax/pkg/auth"
	"github.com/cloudcarver/anclax/pkg/config"
	"github.com/cloudcarver/anclax/pkg/controller"
	"github.com/cloudcarver/anclax/pkg/globalctx"
	"github.com/cloudcarver/anclax/pkg/hooks"
	"github.com/cloudcarver/anclax/pkg/macaroons"
	"github.com/cloudcarver/anclax/pkg/macaroons/store"
	"github.com/cloudcarver/anclax/pkg/metrics"
	"github.com/cloudcarver/anclax/pkg/server"
	"github.com/cloudcarver/anclax/pkg/service"
	"github.com/cloudcarver/anclax/pkg/taskcore"
	"github.com/cloudcarver/anclax/pkg/taskcore/worker"
	"github.com/cloudcarver/anclax/pkg/ws"
	"github.com/cloudcarver/anclax/pkg/zcore/model"
	"github.com/cloudcarver/anclax/pkg/zgen/taskgen"
)

// Injectors from wire.go:

func InitializeApplication(cfg *config.Config, libCfg *config.LibConfig) (*app.Application, error) {
	globalContext := globalctx.New()
	modelInterface, err := model.NewModel(cfg, libCfg)
	if err != nil {
		return nil, err
	}
	taskStoreInterface := taskcore.NewTaskStore(modelInterface)
	taskRunner := taskgen.NewTaskRunner(taskStoreInterface)
	keyStore := store.NewStore(modelInterface, taskRunner)
	caveatParserInterface := macaroons.NewCaveatParser()
	macaroonParserInterface := macaroons.NewMacaroonManager(keyStore, caveatParserInterface)
	anclaxHookInterface := hooks.NewBaseHook()
	authInterface, err := auth.NewAuth(cfg, macaroonParserInterface, caveatParserInterface, anclaxHookInterface)
	if err != nil {
		return nil, err
	}
	serviceInterface := service.NewService(cfg, modelInterface, authInterface, anclaxHookInterface)
	serverInterface := controller.NewController(serviceInterface, authInterface, cfg)
	validator := controller.NewValidator(modelInterface, authInterface)
	websocketController := ws.NewWebsocketController(globalContext, libCfg)
	serverServer, err := server.NewServer(cfg, libCfg, globalContext, authInterface, serverInterface, validator, websocketController)
	if err != nil {
		return nil, err
	}
	metricsServer := metrics.NewMetricsServer(cfg, globalContext)
	executorInterface := asynctask.NewExecutor(modelInterface)
	taskHandler := taskgen.NewTaskHandler(executorInterface)
	workerInterface, err := worker.NewWorker(globalContext, cfg, modelInterface, taskHandler)
	if err != nil {
		return nil, err
	}
	debugServer := app.NewDebugServer(cfg, globalContext)
	closer := app.NewCloser(modelInterface)
	application, err := app.NewApplication(globalContext, cfg, serverServer, metricsServer, workerInterface, debugServer, authInterface, taskStoreInterface, serviceInterface, anclaxHookInterface, caveatParserInterface, closer)
	if err != nil {
		return nil, err
	}
	return application, nil
}
