package initialize

import (
	"go.uber.org/zap"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/interface/client"
	"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
)

type ClientsDeps struct {
	Logger                       *zap.Logger
	AuthURL                      *models.AuthMicroserviceURL
	HubadminURL                  *models.HubadminMicroserviceURL
	CurrencyURL                  *models.CurrencyMicroserviceURL
	DiscountServiceConfiguration *models.DiscountMicroserviceConfiguration
	PaymentServiceConfiguration  *models.PaymentMicroserviceConfiguration
	VerificationURL              *models.VerificationMicroserviceURL
	TemplategenURL               *models.TemplategenMicroserviceURL
}

type Clients struct {
	AuthClient         *client.AuthClient
	HubadminClient     *client.HubadminClient
	CurrencyClient     *client.CurrencyClient
	DiscountClient     *client.DiscountClient
	PaymentClient      *client.PaymentClient
	VerificationClient *client.VerificationClient
	TemplateClient     *client.TemplateClient
}

func NewClients(deps ClientsDeps) *Clients {
	return &Clients{
		AuthClient: client.NewAuthClient(client.AuthClientDeps{
			Logger: deps.Logger,
			URLs:   deps.AuthURL,
		}),
		HubadminClient: client.NewHubadminClient(client.HubadminClientDeps{
			Logger: deps.Logger,
			URLs:   deps.HubadminURL,
		}),
		CurrencyClient: client.NewCurrencyClient(client.CurrencyClientDeps{
			Logger: deps.Logger,
			URLs:   deps.CurrencyURL,
		}),
		DiscountClient: client.NewDiscountClient(client.DiscountClientDeps{
			Logger:              deps.Logger,
			DiscountServiceHost: deps.DiscountServiceConfiguration.HostGRPC,
		}),
		PaymentClient: client.NewPaymentClient(client.PaymentClientDeps{
			Logger:             deps.Logger,
			PaymentServiceHost: deps.PaymentServiceConfiguration.HostGRPC,
		}),
		VerificationClient: client.NewVerificationClient(client.VerificationClientDeps{
			Logger: deps.Logger,
			URLs:   deps.VerificationURL,
		}),
		TemplateClient: client.NewTemplateClient(client.TemplateClientDeps{
			Logger: deps.Logger,
			URLs:   deps.TemplategenURL,
		}),
	}
}
