package resources

import (
	"cloud.o-forge.io/core/oc-lib/dbs"
	"cloud.o-forge.io/core/oc-lib/models/booking"
	"cloud.o-forge.io/core/oc-lib/models/common/models"
	"cloud.o-forge.io/core/oc-lib/models/common/pricing"
	"cloud.o-forge.io/core/oc-lib/models/utils"
	"cloud.o-forge.io/core/oc-lib/tools"
)

type PricedResourceITF interface {
	pricing.PricedItemITF
}

type ResourceInterface interface {
	utils.DBObject
	FilterPeer(peerID string) *dbs.Filters
	GetBookingModes() map[booking.BookingMode]*pricing.PricingVariation
	ConvertToPricedResource(t tools.DataType, a *int, selectedPartnership *int, selectedBuyingStrategy *int, selectedStrategy *int, b *int, request *tools.APIRequest) (pricing.PricedItemITF, error)
	GetType() string
	ClearEnv() utils.DBObject
	VerifyBuy()
	SetAllowedInstances(request *tools.APIRequest, instance_id ...string) []ResourceInstanceITF
	AddInstances(instance ResourceInstanceITF)
	GetSelectedInstance(index *int) ResourceInstanceITF
	StoreDraftDefault()

	GetEnv() []models.Param
	GetInputs() []models.Param
	GetOutputs() []models.Param
}

type ResourceInstanceITF interface {
	utils.DBObject
	GetID() string
	GetName() string
	GetOrigin() OriginMeta
	IsPeerless() bool
	FilterInstance(peerID string)
	GetProfile(peerID string, partnershipIndex *int, buying *int, strategy *int) pricing.PricingProfileITF
	GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF
	GetPeerGroups() ([]ResourcePartnerITF, []map[string][]string)
	ClearPeerGroups()
	GetPartnerships() []ResourcePartnerITF
	GetAverageDurationS() float64
	UpdateAverageDuration(actualS float64)
}

type ResourcePartnerITF interface {
	GetPricingsProfiles(peerID string, groups []string) []pricing.PricingProfileITF
	GetPeerGroups() map[string][]string
	ClearPeerGroups()
	GetProfile(buying *int, strategy *int) pricing.PricingProfileITF
	FilterPartnership(peerID string)
}
