package model

import "github.com/tech/sendico/pkg/db/storable"

// Currency captures rounding metadata for a given currency code.
type Currency struct {
	storable.Base `bson:",inline" json:",inline"`

	Code        string       `bson:"code" json:"code"`
	Decimals    uint32       `bson:"decimals" json:"decimals"`
	Rounding    RoundingMode `bson:"rounding" json:"rounding"`
	DisplayName string       `bson:"displayName,omitempty" json:"displayName,omitempty"`
	Symbol      string       `bson:"symbol,omitempty" json:"symbol,omitempty"`
	MinUnit     string       `bson:"minUnit,omitempty" json:"minUnit,omitempty"`
}

// Collection implements storable.Storable.
func (*Currency) Collection() string {
	return CurrenciesCollection
}

// CurrencySettings embeds precision details inside a Pair document.
type CurrencySettings struct {
	Code     string       `bson:"code" json:"code"`
	Decimals uint32       `bson:"decimals" json:"decimals"`
	Rounding RoundingMode `bson:"rounding" json:"rounding"`
}
