package serverimp

import (
	oracleclient "github.com/tech/sendico/fx/oracle/client"
	ledgerclient "github.com/tech/sendico/ledger/client"
	quotesvc "github.com/tech/sendico/payments/quotation/internal/service/quotation"
	"github.com/tech/sendico/payments/storage"
	"github.com/tech/sendico/pkg/discovery"
	"github.com/tech/sendico/pkg/mlogger"
	feesv1 "github.com/tech/sendico/pkg/proto/billing/fees/v1"
	"github.com/tech/sendico/pkg/server/grpcapp"
	"google.golang.org/grpc"
)

type quoteService interface {
	grpcapp.Service
	Shutdown()
}

type clientDependencies struct {
	feesConn              *grpc.ClientConn
	feesClient            feesv1.FeeEngineClient
	oracleClient          oracleclient.Client
	ledgerClient          ledgerclient.Client
	gatewayResolver       quotesvc.ChainGatewayResolver
	gatewayInvokeResolver quotesvc.GatewayInvokeResolver
}

type Imp struct {
	logger mlogger.Logger
	file   string
	debug  bool

	config  *config
	app     *grpcapp.App[storage.Repository]
	service quoteService
	deps    *clientDependencies

	discoveryWatcher   *discovery.RegistryWatcher
	discoveryReg       *discovery.Registry
	discoveryAnnouncer *discovery.Announcer
	discoveryClients   *discoveryClientResolver
}
