//go:build wireinject
// +build wireinject

// The build tag makes sure the stub is not built in the final build.

package main

import (
	"log/slog"

	"kra/app/system/internal/app"
	"kra/app/system/internal/biz"
	"kra/app/system/internal/conf"
	"kra/app/system/internal/data"
	"kra/app/system/internal/initialize"
	"kra/app/system/internal/integration"
	"kra/app/system/internal/integration/cache"
	"kra/app/system/internal/server"
	"kra/app/system/internal/server/handler"
	"kra/app/system/internal/server/router"
	"kra/app/system/internal/service"
	"kra/app/system/internal/worker"
	"kra/pkg/logging"
	platformtask "kra/pkg/task"

	"github.com/go-kratos/kratos/v3"
	"github.com/google/wire"
)

// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Runtime, *slog.Logger, *logging.ReloadableLogger, string) (*kratos.App, func(), error) {
	panic(wire.Build(
		server.ProviderSet,
		handler.ProviderSet,
		router.ProviderSet,
		worker.ProviderSet,
		app.Catalog,
		app.TaskRegistry,
		app.Runtime,
		data.ProviderSet,
		integration.ProviderSet,
		initialize.ProviderSet,
		wire.Bind(new(initialize.Backend), new(*data.Data)),
		wire.Bind(new(cache.RedisProvider), new(*data.Data)),
		wire.Bind(new(biz.TaskMethodRegistry), new(*platformtask.Registry)),
		biz.ProviderSet,
		service.ProviderSet,
		newApp,
	))
}
