This commit is contained in:
mr
2025-06-19 08:11:11 +02:00
parent 29bc21735d
commit 938f9f1326
17 changed files with 104 additions and 72 deletions

View File

@@ -9,6 +9,7 @@ import (
type BuyingStrategy int
// should except... on
const (
UNLIMITED BuyingStrategy = iota
SUBSCRIPTION
@@ -40,6 +41,10 @@ const (
PER_MONTH
)
func IsTimeStrategy(i int) bool {
return len(TimePricingStrategyList()) < i
}
func (t TimePricingStrategy) String() string {
return [...]string{"ONCE", "PER SECOND", "PER MINUTE", "PER HOUR", "PER DAY", "PER WEEK", "PER MONTH"}[t]
}
@@ -101,6 +106,7 @@ func BookingEstimation(t TimePricingStrategy, price float64, locationDurationInS
return 0, errors.New("pricing strategy not found")
}
// may suppress in pricing strategy -> to set in map
type PricingStrategy[T Strategy] struct {
Price float64 `json:"price" bson:"price" default:"0"` // Price is the Price of the pricing
Currency string `json:"currency" bson:"currency" default:"USD"` // Currency is the currency of the pricing