package cloudmarketplacehandler

import (
	"github.com/pingcap/dbaas/billing2/forms"
	"github.com/pingcap/dbaas/billing2/utils/httpclient"
)

type MarketplaceProvider interface {
	GetToken() (string, error)
	GetAPIClient() httpclient.HTTPClient
	GetSubscription(subscriptionID string) (forms.SubscriptionDetails, error)
	CancelSubscription(subscriptionID string) error
	GetSubscriptionsByAzureSubscriptionID(subscriptionID string, isSubscribed bool) (forms.SubscriptionList, error)
	GetSubscriptionListByStatus(Status map[string]bool) (map[string]string, error)
	GetSubscriptionList() (subscriptionList forms.SubscriptionList, err error)
	ActivateSubscription(subscriptionID string) error
}

type MarketplaceHandler interface {
	GetMarketplace(provider string) (MarketplaceProvider, error)
}

var globalHandler MarketplaceHandler = nil

func GetMarketplaceHandler() MarketplaceHandler {
	return globalHandler
}
func SetMarketplaceHandler(handler MarketplaceHandler) {
	globalHandler = handler
}
