package wallet

import (
	"context"
	"time"

	"github.com/tech/sendico/gateway/chain/internal/keymanager"
	"github.com/tech/sendico/gateway/chain/internal/service/gateway/drivers"
	"github.com/tech/sendico/gateway/chain/internal/service/gateway/rpcclient"
	"github.com/tech/sendico/gateway/chain/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
	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
}
