package model

import "github.com/tech/sendico/pkg/model"

// Collection names used by the FX oracle persistence layer.
const (
	RatesCollection      = "rates"
	QuotesCollection     = "quotes"
	CurrenciesCollection = "currencies"
	PairsCollection      = "pairs"
)

// QuoteStatus tracks the lifecycle state of a quote.
type QuoteStatus string

const (
	QuoteStatusIssued   QuoteStatus = "issued"
	QuoteStatusConsumed QuoteStatus = "consumed"
	QuoteStatusExpired  QuoteStatus = "expired"
)

// QuoteSide expresses the trade direction for the requested quote.
type QuoteSide string

const (
	QuoteSideBuyBaseSellQuote QuoteSide = "buy_base_sell_quote"
	QuoteSideSellBaseBuyQuote QuoteSide = "sell_base_buy_quote"
)

// QuoteAmountType indicates which leg amount was provided by the caller.
type QuoteAmountType string

const (
	QuoteAmountTypeBase  QuoteAmountType = "base"
	QuoteAmountTypeQuote QuoteAmountType = "quote"
)

// RoundingMode describes how rounding should be applied for a currency.
type RoundingMode string

const (
	RoundingModeUnspecified RoundingMode = "unspecified"
	RoundingModeHalfEven    RoundingMode = "half_even"
	RoundingModeHalfUp      RoundingMode = "half_up"
	RoundingModeDown        RoundingMode = "down"
)

// CurrencyPair identifies an FX pair.
type CurrencyPair struct {
	Base  string `bson:"base" json:"base"`
	Quote string `bson:"quote" json:"quote"`
}

// QuoteMeta carries request-scoped metadata associated with a quote.
type QuoteMeta struct {
	model.OrganizationBoundBase `bson:",inline" json:",inline"`

	RequestRef     string `bson:"requestRef,omitempty" json:"requestRef,omitempty"`
	TenantRef      string `bson:"tenantRef,omitempty" json:"tenantRef,omitempty"`
	TraceRef       string `bson:"traceRef,omitempty" json:"traceRef,omitempty"`
	IdempotencyKey string `bson:"idempotencyKey,omitempty" json:"idempotencyKey,omitempty"`
}
