package serverimp

import (
	"context"

	chainclient "github.com/tech/sendico/gateway/chain/client"
	"github.com/tech/sendico/pkg/merrors"
)

type discoveryGatewayInvokeResolver struct {
	resolver *discoveryClientResolver
}

func (r discoveryGatewayInvokeResolver) Resolve(ctx context.Context, invokeURI string) (chainclient.Client, error) {
	if r.resolver == nil {
		return nil, merrors.Internal("discovery gateway resolver unavailable")
	}
	return r.resolver.ChainClient(ctx, invokeURI)
}
