package registry

import (
	"context"
	"os"
)

var (
	DefaultRegistry Registry
)

const (
	DiscoveryUrlEvn = "DISCOVERY_URL"
)

type (
	Registry interface {
		Register(ctx context.Context, instance *ServiceNode) (err error)
		Deregister(ctx context.Context, instance *ServiceNode) (err error)
		Get(ctx context.Context, name string) ([]*ServiceNode, error)
		Fetch(ctx context.Context) ([]*ServiceNode, error)
	}
)

func init() {
	DefaultRegistry = NewDiscovery(os.Getenv(DiscoveryUrlEvn))
}
