modelling
This commit is contained in:
@@ -3,7 +3,6 @@ package pricing
|
||||
import (
|
||||
"time"
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
)
|
||||
|
||||
@@ -22,33 +21,38 @@ const (
|
||||
REFUND_ON_EARLY_END
|
||||
)
|
||||
|
||||
type AccessPricingProfile struct { // only use for acces such as : DATA && PROCESSING
|
||||
utils.DBObject
|
||||
DefaultRefund RefundType `json:"default_refund" bson:"default_refund"` // DefaultRefund is the default refund type of the pricing
|
||||
RefundRatio int32 `json:"refund_ratio" bson:"refund_ratio" default:"0"` // RefundRatio is the refund ratio if missing
|
||||
type AccessPricingProfile[T Strategy] struct { // only use for acces such as : DATA && PROCESSING
|
||||
ID string `json:"id,omitempty" bson:"id,omitempty"` // ID is the ID of the pricing
|
||||
Pricing PricingStrategy[T] `json:"price,omitempty" bson:"price,omitempty"` // Price is the price of the resource
|
||||
DefaultRefund RefundType `json:"default_refund" bson:"default_refund"` // DefaultRefund is the default refund type of the pricing
|
||||
RefundRatio int32 `json:"refund_ratio" bson:"refund_ratio" default:"0"` // RefundRatio is the refund ratio if missing
|
||||
}
|
||||
|
||||
func (b *AccessPricingProfile) GetOverrideStrategyValue() int {
|
||||
func (b *AccessPricingProfile[T]) GetID() string {
|
||||
return b.ID
|
||||
}
|
||||
|
||||
func (b *AccessPricingProfile[T]) GetOverrideStrategyValue() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
type ExploitPricingStrategy int
|
||||
type ExploitPrivilegeStrategy int
|
||||
|
||||
const (
|
||||
BASIC ExploitPricingStrategy = iota
|
||||
BASIC ExploitPrivilegeStrategy = iota
|
||||
GARANTED_ON_DELAY
|
||||
GARANTED
|
||||
)
|
||||
|
||||
func (t ExploitPricingStrategy) String() string {
|
||||
func (t ExploitPrivilegeStrategy) String() string {
|
||||
return [...]string{"BASIC", "GARANTED_ON_DELAY", "GARANTED"}[t]
|
||||
}
|
||||
|
||||
type ExploitPricingProfile struct { // only use for exploit such as : STORAGE, COMPUTE, WORKFLOW
|
||||
AccessPricingProfile
|
||||
type ExploitPricingProfile[T Strategy] struct { // only use for exploit such as : STORAGE, COMPUTE, WORKFLOW
|
||||
AccessPricingProfile[T]
|
||||
AdditionnalRefundTypes []RefundType `json:"refund_types" bson:"refund_types"` // RefundTypes is the refund types of the pricing
|
||||
|
||||
PrivilegeStrategy ExploitPricingStrategy `json:"privilege_strategy,omitempty" bson:"privilege_strategy,omitempty"` // Strategy is the strategy of the pricing
|
||||
PrivilegeStrategy ExploitPrivilegeStrategy `json:"privilege_strategy,omitempty" bson:"privilege_strategy,omitempty"` // Strategy is the strategy of the pricing
|
||||
GarantedDelaySecond uint
|
||||
|
||||
Exceeding bool
|
||||
|
Reference in New Issue
Block a user