package ledger

import (
	"github.com/shopspring/decimal"
	"github.com/tech/sendico/pkg/model"
	"github.com/tech/sendico/pkg/mservice"
	"go.mongodb.org/mongo-driver/v2/bson"
)

type AccountBalance struct {
	model.PermissionBound `bson:",inline" json:",inline"`
	LedgerAccountRef      bson.ObjectID   `bson:"ledgerAccountRef" json:"ledgerAccountRef"` // unique
	Balance               decimal.Decimal `bson:"balance" json:"balance"`
	Version               int64           `bson:"version" json:"version"` // for optimistic locking
}

func (a *AccountBalance) Collection() string {
	return mservice.LedgerBalances
}
