package trading

import "sort"

// SortCashBalances sorts cash balances by currency string for stable output.
// It modifies the slice in-place so snapshot serialisation is deterministic.
func SortCashBalances(balances []CashBalance) {
	sort.Slice(balances, func(i, j int) bool {
		return string(balances[i].Currency) < string(balances[j].Currency)
	})
}

// SortPositionSnapshots sorts position snapshots by instrument ID for stable
// output. It modifies the slice in-place.
func SortPositionSnapshots(positions []PositionSnapshot) {
	sort.Slice(positions, func(i, j int) bool {
		return string(positions[i].InstrumentID) < string(positions[j].InstrumentID)
	})
}

// HasRawAccountNumber returns false unconditionally; it documents the invariant
// that AccountSnapshot must never hold a raw broker account number. The raw
// account identifier is resolved inside the adapter and must not escape the
// BrokerPort boundary.
func HasRawAccountNumber(_ AccountSnapshot) bool {
	return false
}
