package model

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

// Collection names used by the ledger persistence layer.
const (
	JournalEntriesCollection  = "journal_entries"
	PostingLinesCollection    = "posting_lines"
	AccountBalancesCollection = "account_balances"
	OutboxCollection          = "outbox"
)

// EntryType categorizes journal entries by their business purpose.
type EntryType string

const (
	EntryTypeCredit   EntryType = "credit"
	EntryTypeDebit    EntryType = "debit"
	EntryTypeTransfer EntryType = "transfer"
	EntryTypeFX       EntryType = "fx"
	EntryTypeFee      EntryType = "fee"
	EntryTypeAdjust   EntryType = "adjust"
	EntryTypeReverse  EntryType = "reverse"
)

// LineType distinguishes the role of a posting line within a journal entry.
type LineType string

const (
	LineTypeMain     LineType = "main"
	LineTypeFee      LineType = "fee"
	LineTypeSpread   LineType = "spread"
	LineTypeReversal LineType = "reversal"
)

// OutboxStatus tracks the delivery state of an outbox event.
type OutboxStatus string

const (
	OutboxStatusPending OutboxStatus = "pending"
	OutboxStatusSent    OutboxStatus = "sent"
	OutboxStatusFailed  OutboxStatus = "failed"
)

// LedgerMeta carries organization-scoped metadata for ledger entities.
type LedgerMeta struct {
	model.OrganizationBoundBase `bson:",inline" json:",inline"`

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