package initialize

import (
	"gitea.pena/PenaSide/customer/internal/interface/client"
	"gitea.pena/PenaSide/customer/internal/models"
	"go.uber.org/zap"
	"gopkg.in/tucnak/telebot.v2"
)

type ClientsDeps struct {
	Logger                   *zap.Logger
	AuthURL                  string
	HubadminURL              string
	CurrencyURL              string
	DiscountServiceURL       string
	PaymentServiceURL        string
	VerificationURL          string
	TemplategenURL           string
	MailClient               models.MailClientCfg
	CodewordServiceHost      string
	NotificationRsPayChannel int64
	Notifier                 *telebot.Bot
}

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

func NewClients(deps ClientsDeps) *Clients {
	return &Clients{
		AuthClient: client.NewAuthClient(client.AuthClientDeps{
			Logger: deps.Logger,
			URL:    deps.AuthURL,
		}),
		HubadminClient: client.NewHubadminClient(client.HubadminClientDeps{
			Logger: deps.Logger,
			URL:    deps.HubadminURL,
		}),
		CurrencyClient: client.NewCurrencyClient(client.CurrencyClientDeps{
			Logger: deps.Logger,
			URL:    deps.CurrencyURL,
		}),
		DiscountClient: client.NewDiscountClient(client.DiscountClientDeps{
			Logger:              deps.Logger,
			DiscountServiceHost: deps.DiscountServiceURL,
		}),
		PaymentClient: client.NewPaymentClient(client.PaymentClientDeps{
			Logger:             deps.Logger,
			PaymentServiceHost: deps.PaymentServiceURL,
		}),
		VerificationClient: client.NewVerificationClient(client.VerificationClientDeps{
			Logger: deps.Logger,
			URL:    deps.VerificationURL,
		}),
		TemplateClient: client.NewTemplateClient(client.TemplateClientDeps{
			Logger: deps.Logger,
			URL:    deps.TemplategenURL,
		}),
		MailClient: client.NewMailClient(deps.MailClient, deps.Logger),
		CodewordClient: client.NewCodewordClient(client.CodewordClientDeps{
			Logger:              deps.Logger,
			CodewordServiceHost: deps.CodewordServiceHost,
		}),
		TelegramClient: client.NewTelegramClient(client.TelegramClientDeps{
			Notifier:           deps.Notifier,
			NotifierPayChannel: deps.NotificationRsPayChannel,
		}),
	}
}
