// Code generated by Wire. DO NOT EDIT.

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

package main

import (
	"go-web-wire-starter/config"
	"go-web-wire-starter/internal/command"
	"go-web-wire-starter/internal/compo"
	"go-web-wire-starter/internal/compo/cron"
	"go-web-wire-starter/internal/compo/email"
	"go-web-wire-starter/internal/compo/storage"
	"go-web-wire-starter/internal/compo/storage/cos"
	"go-web-wire-starter/internal/compo/storage/kodo"
	"go-web-wire-starter/internal/compo/storage/local"
	"go-web-wire-starter/internal/compo/storage/oss"
	"go-web-wire-starter/internal/dao"
	"go-web-wire-starter/internal/handler"
	"go-web-wire-starter/internal/mildware"
	"go-web-wire-starter/internal/service"
	"go-web-wire-starter/router"
	"go.uber.org/zap"
	"gopkg.in/natefinch/lumberjack.v2"
)

// Injectors from wire.go:

// wireApp init application.
func wireApp(configuration *config.Configuration, lumberjackLogger *lumberjack.Logger, zapLogger *zap.Logger) (*App, func(), error) {
	db := dao.NewDB(configuration, zapLogger)
	client := dao.NewRedis(configuration, zapLogger)
	sonyflake := compo.NewSonyFlake()
	data, cleanup, err := dao.NewData(zapLogger, db, client, sonyflake)
	if err != nil {
		return nil, nil, err
	}
	userDao := dao.NewUserDao(data, zapLogger)
	userService := service.NewUserService(zapLogger, userDao)
	jwtDao := dao.NewJwtDao(data, zapLogger)
	lockBuilder := compo.NewLockBuilder(client)
	jwtService := service.NewJwtService(zapLogger, configuration, userService, jwtDao, lockBuilder)
	userHandler := handler.NewUserHandler(zapLogger, userService, jwtService)
	cosDriver, err := cos.NewCosDriver(configuration)
	if err != nil {
		cleanup()
		return nil, nil, err
	}
	localDriver, err := local.NewLocalDriver(configuration)
	if err != nil {
		cleanup()
		return nil, nil, err
	}
	ossDriver, err := oss.NewOssDriver(configuration)
	if err != nil {
		cleanup()
		return nil, nil, err
	}
	kodoDriver, err := kodo.NewKodoDriver(configuration)
	if err != nil {
		cleanup()
		return nil, nil, err
	}
	storageStorage := storage.NewStorage(configuration, zapLogger, cosDriver, localDriver, ossDriver, kodoDriver)
	mediaDao := dao.NewMediaDao(data, zapLogger, storageStorage)
	mediaService := service.NewMediaService(configuration, zapLogger, mediaDao, storageStorage)
	mediaHandler := handler.NewMediaHandler(zapLogger, mediaService)
	pool := email.NewEmailPool(configuration, zapLogger)
	emailDriver := email.NewEmailDriver(pool, configuration)
	captchaCompo := compo.NewCaptchaCompo(client, zapLogger, configuration)
	captchaService := service.NewCaptchaService(configuration, zapLogger, emailDriver, client, captchaCompo)
	captchaHandler := handler.NewCaptchaHandler(zapLogger, captchaService)
	cors := mildware.NewCorsM()
	jwtAuth := mildware.NewJWTAuthM(configuration, jwtService)
	recovery := mildware.NewRecoveryM(lumberjackLogger)
	limiterManager := compo.NewLimiterManager()
	limiter := mildware.NewLimiterM(limiterManager)
	engine := router.NewRouter(configuration, userHandler, mediaHandler, captchaHandler, cors, jwtAuth, recovery, limiter)
	server := newHttpServer(configuration, engine)
	exampleJob := cron.NewExampleJob(zapLogger)
	cronCron := cron.NewCron(data, zapLogger, exampleJob)
	app := newApp(configuration, zapLogger, server, cronCron)
	return app, func() {
		cleanup()
	}, nil
}

// wireCommand init application.
func wireCommand(configuration *config.Configuration, lumberjackLogger *lumberjack.Logger, zapLogger *zap.Logger) (*command.Command, func(), error) {
	db := dao.NewDB(configuration, zapLogger)
	dataBaseCommand := command.NewDataBaseCommand(zapLogger, db)
	commandCommand := command.NewCommand(dataBaseCommand)
	return commandCommand, func() {
	}, nil
}
