# `Logistiki.Ledger.BeancountMapper`
[🔗](https://github.com/thanos/logistiki/blob/v0.1.0/lib/logistiki/ledger/beancount_mapper.ex#L1)

Maps Logistiki virtual accounts, journals, and postings to Beancount
directives and back.

Beancount is the accounting oracle, not the domain model. Beancount-specific
structs never escape this module (and the `Logistiki.Ledger.Beancount`
backend). The public API only sees `Logistiki.Projections.*` structs.

## Account code mapping

Logistiki virtual account codes are colon-separated and human-readable
(`LIABILITIES:CLIENT_DEPOSITS:USD:ACME:OPERATING`). The mapper produces
deterministic Beancount account names by mapping the account type to a
Beancount root (`Assets`, `Liabilities`, `Equity`, `Income`, `Expenses`) and
CamelCasing the remaining segments.

# `from_beancount_balance`
*since 0.1.0* 

Converts a Beancount balances result into a map of account -> balance.

# `from_beancount_entry`
*since 0.1.0* 

Converts a Beancount query row into a plain map of column -> value.

# `normal_debit?`
*since 0.1.0* 

True when the account type has a debit normal balance.

# `root_for_type`
*since 0.1.0* 

Returns the beancount root for a Logistiki account type.

# `signed_amount`
*since 0.1.0* 

Returns the signed Beancount amount for a Logistiki posting.

Beancount encodes direction as sign: debits are positive, credits are
negative, regardless of account type. Account balances then read naturally
(assets positive, liabilities/income negative) and match Logistiki's
net = debit - credit projection.

# `to_beancount_account`
*since 0.1.0* 

Maps a `%VirtualAccount{}` to a deterministic Beancount account name.

# `to_beancount_directive`
*since 0.1.0* 

Maps a Logistiki journal + postings + accounts to a Beancount transaction directive.

# `to_beancount_opens`
*since 0.1.0* 

Maps a list of accounts to Beancount `open` directives.

# `to_beancount_posting`
*since 0.1.0* 

Maps a Logistiki posting to a Beancount posting (signed amount).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
