package transfer

import (
	"context"
	"time"

	"github.com/tech/sendico/gateway/tron/internal/keymanager"
	"github.com/tech/sendico/gateway/tron/internal/service/gateway/drivers"
	"github.com/tech/sendico/gateway/tron/internal/service/gateway/rpcclient"
	"github.com/tech/sendico/gateway/tron/internal/service/gateway/tronclient"
	"github.com/tech/sendico/gateway/tron/shared"
	"github.com/tech/sendico/gateway/tron/storage"
	clockpkg "github.com/tech/sendico/pkg/clock"
	"github.com/tech/sendico/pkg/mlogger"
)

type Deps struct {
	Logger           mlogger.Logger
	Drivers          *drivers.Registry
	Networks         *rpcclient.Registry
	TronClients      *tronclient.Registry // Native TRON gRPC clients
	KeyManager       keymanager.Manager
	Storage          storage.Repository
	Clock            clockpkg.Clock
	RPCTimeout       time.Duration
	EnsureRepository func(context.Context) error
	LaunchExecution  func(transferRef, sourceWalletRef string, network shared.Network)
}

func (d Deps) WithLogger(name string) Deps {
	if d.Logger != nil {
		d.Logger = d.Logger.Named(name)
	}
	return d
}
