Selects the accounting policy for a normalized event using the knowledge layer.
This is a thin façade over Logistiki.Knowledge.KnowledgeBase for callers
that only need the policy decision.
Summary
Functions
Returns the accounting policy for normalized_event, or an error.
Functions
@spec select(Logistiki.Event.Normalized.t()) :: {:ok, atom()} | {:error, :blocked_event | :approval_required | :no_policy_found | term()}
Returns the accounting policy for normalized_event, or an error.
Arguments
normalized_event—%Logistiki.Event.Normalized{}.
Returns
{:ok, atom()}— the selected policy (e.g.:cash_deposit).{:error, :blocked_event}— a business rule blocked the event.{:error, :approval_required}— the event requires approval.{:error, :no_policy_found}— no policy matched.{:error, term()}— knowledge evaluation failed.
Examples
iex> {:ok, :cash_deposit} = Logistiki.Knowledge.PolicySelector.select(normalized_deposit)
iex> {:error, :blocked_event} = Logistiki.Knowledge.PolicySelector.select(blocked_event)
iex> {:error, :no_policy_found} = Logistiki.Knowledge.PolicySelector.select(unknown_event)