Define observed cost values and aggregation
This commit is contained in:
30
cost.go
Normal file
30
cost.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package promptkit
|
||||
|
||||
import "go.maximumdirect.net/promptkit/internal/domain"
|
||||
|
||||
// CostSource identifies how an observed USD cost was supplied.
|
||||
type CostSource string
|
||||
|
||||
const (
|
||||
CostSourceNone CostSource = ""
|
||||
CostSourceProvider CostSource = "provider"
|
||||
CostSourceConfiguredZero CostSource = "configured_zero"
|
||||
CostSourceMixed CostSource = "mixed"
|
||||
)
|
||||
|
||||
// ObservedCost reports an available USD subtotal and its coverage and source.
|
||||
// Complete describes coverage of dispatched attempts, not billing verification.
|
||||
type ObservedCost struct {
|
||||
Value float64 `json:"value"`
|
||||
Known bool `json:"known"`
|
||||
Complete bool `json:"complete"`
|
||||
Source CostSource `json:"source"`
|
||||
}
|
||||
|
||||
func fromDomainCost(value domain.ObservedCost) ObservedCost {
|
||||
return ObservedCost{Value: value.Value, Known: value.Known, Complete: value.Complete, Source: CostSource(value.Source)}
|
||||
}
|
||||
|
||||
func toDomainCost(value ObservedCost) domain.ObservedCost {
|
||||
return domain.ObservedCost{Value: value.Value, Known: value.Known, Complete: value.Complete, Source: domain.CostSource(value.Source)}
|
||||
}
|
||||
Reference in New Issue
Block a user