package wallet

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/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
	BalanceCacheTTL  time.Duration
	RPCTimeout       time.Duration
	EnsureRepository func(context.Context) error
}

func (d Deps) WithLogger(name string) Deps {
	if d.Logger == nil {
		panic("wallet deps: logger is required")
	}
	d.Logger = d.Logger.Named(name)
	return d
}
