package initialize

import (
	"go.uber.org/zap"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/grpc/customer"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/grpc/payment"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/rest/account"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/rest/cart"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/rest/currency"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/rest/history"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/controller/rest/wallet"
)

type ControllersDeps struct {
	Logger   *zap.Logger
	Services *Services
}

type Controllers struct {
	AccountController  *account.Controller
	CurrencyController *currency.Controller
	CartController     *cart.Controller
	HistoryController  *history.Controller
	WalletController   *wallet.Controller
	PaymentController  *payment.Controller
	CustomerController *customer.Controller
}

func NewControllers(deps ControllersDeps) *Controllers {
	return &Controllers{
		AccountController: account.New(account.Deps{
			Logger:  deps.Logger,
			Service: deps.Services.AccountService,
		}),
		CurrencyController: currency.New(currency.Deps{
			Logger:          deps.Logger,
			CurrencyService: deps.Services.CurrencyService,
		}),
		CartController: cart.New(cart.Deps{
			Logger:      deps.Logger,
			CartService: deps.Services.CartService,
		}),
		HistoryController: history.New(history.Deps{
			Logger:         deps.Logger,
			HistoryService: deps.Services.HistoryService,
		}),
		WalletController: wallet.New(wallet.Deps{
			Logger:         deps.Logger,
			WalletService:  deps.Services.WalletService,
			PaymentService: deps.Services.PaymentService,
		}),
		PaymentController: payment.New(payment.Deps{
			Logger:                 deps.Logger,
			PaymentCallbackService: deps.Services.PaymentCallbackService,
		}),
		CustomerController: customer.New(customer.Deps{
			Logger:         deps.Logger,
			HistoryService: deps.Services.HistoryService,
		}),
	}
}
