> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Eventos do Midaz

> Consulte todos os fatos de evento JSON públicos emitidos pelo Midaz, incluindo headers do CloudEvents, tópicos da aplicação, comportamento de entrega e contratos de dados.

O Midaz emite seus fatos de negócio JSON públicos como CloudEvents 1.0 no modo de conteúdo binário pelo Kafka.

## Catálogo JSON público do ledger

O manifesto público do ledger contém as definições verificadas a seguir. Toda definição catalogada tem um caminho de emissão em produção fora de testes.

| Catalogado | Emitido | Apenas catálogo |
| -: | -: | -: |
| 54 | 54 | 0 |

## Envelope do CloudEvents

Todo fato JSON público usa o envelope compartilhado abaixo. Os headers carregam informações de roteamento e schema. O valor do Kafka carrega o objeto JSON `data`.

| Header | Presença e valor |
| - | - |
| `ce-specversion` | Sempre `1.0`. |
| `ce-id` | Sempre; identificador de evento opaco definido pelo produtor. |
| `ce-source` | Sempre `ledger`. |
| `ce-type` | Sempre `studio.lerian.ledger.<resource>.<event>`. |
| `ce-time` | Sempre; timestamp em RFC 3339. |
| `ce-resourcetype` | Sempre; o token de recurso da chave de definição. |
| `ce-eventtype` | Sempre; o token de evento da chave de definição. |
| `ce-subject` | Definido pela expressão específica do payload listada em cada contrato. |
| `ce-tenantid` | **Sempre presente.** O seu ID de tenant, ou o literal `default` quando o evento não tem tenant. |
| `ce-schemaversion` | `1.2.0` para `transaction_route.created` e `transaction_route.updated`; `1.1.0` para os outros quatro fatos de rota de operação e rota de transação; `1.0.0` para os outros 48. |
| `ce-datacontenttype` | `application/json`. |

## Tópicos, manifesto e roteamento

O tópico da aplicação identifica a aplicação produtora, não um evento individual. Roteie um registro por `ce-resourcetype` e `ce-eventtype`, e valide `ce-schemaversion` antes de decodificar seu valor `data`.

* **Fatos:** `lerian.streaming.ledger`
* **Rota DLQ:** `lerian.streaming.ledger.dlq`
* **Manifesto:** `GET /v1/streaming/manifest` expõe o catálogo JSON público e o mapeamento de tópicos, inclusive enquanto a publicação está desabilitada.

## Semântica de entrega e falha

A publicação fica desabilitada até que `STREAMING_ENABLED=true` e a configuração do broker seja bem-sucedida. Quando habilitado, o Midaz emite depois da mudança de estado de negócio. Ele não usa um outbox transacional.

* **Política:** toda definição JSON pública é um `fact` com entrega direta, tratamento de DLQ por `on_routable_failure` e `fallback_on_circuit_open`.
* **Limite real do Midaz:** como o Midaz não tem outbox, o fallback de circuito aberto não consegue persistir um evento. Os caminhos de emissão registram em log e engolem os erros de publicação em vez de retorná-los ao comando de negócio.
* **Momento:** o Midaz emite os eventos `transaction.*`, `balance.changed` e de overdraft logo depois do commit da transação, antes de armazenar os metadados e as dívidas de tarifa da transação. Um consumidor que lê a transação ao receber o evento pode não encontrá-los.
* **Exclusão de conta:** excluir uma conta também emite `instrument.deleted`, `fee_packages.updated` e `fee_billing_packages.updated` para os Instrumentos e os pacotes que a exclusão altera.
* **Requisito do consumidor:** a entrega do broker é pelo menos uma vez para os registros publicados. Torne os handlers idempotentes e faça deduplicação com `(ce-source, ce-id)`.

## Plano legado separado do RabbitMQ

O Midaz também tem exchanges de compatibilidade para notificações selecionadas de overdraft e auditoria. Elas formam um plano legado separado do RabbitMQ e não trazem o catálogo JSON público completo de 54 eventos. Novas integrações devem usar o contrato Kafka desta página.

## Contratos `data`

Cada nome de campo é o seu nome JSON. `?` significa que o campo tem `omitempty`. `| null` significa que o campo é anulável e o produtor sempre o inclui. Um comentário de tipo de origem preserva o tipo do inventário exatamente. Valores decimais são strings JSON, nunca números de ponto flutuante binários.

### Mapeamentos de tipo de origem compartilhados

```typescript theme={null}
type DecimalString = string // JSON encoding of decimal.Decimal
type JsonRawMessage = unknown // Go: json.RawMessage

type MmodelStatus = { // Go: mmodel.Status
  code: string // string; wire null: false; omitempty: false
  description: string | null // *string; wire null: true; omitempty: false
}

type BalanceSettings = { // Go: mmodel.BalanceSettings
  balanceScope?: string // string; wire null: false; omitempty: true
  allowOverdraft: boolean // bool; wire null: false; omitempty: false
  overdraftLimitEnabled: boolean // bool; wire null: false; omitempty: false
  overdraftLimit?: string // *string; wire null: false; omitempty: true
}

type AccountingRubric = { // Go: mmodel.AccountingRubric
  code: string // string; wire null: false; omitempty: false
  description: string // string; wire null: false; omitempty: false
}

type AccountingEntry = { // Go: mmodel.AccountingEntry
  debit: AccountingRubric | null // *AccountingRubric; wire null: true; omitempty: false
  credit: AccountingRubric | null // *AccountingRubric; wire null: true; omitempty: false
}

type AccountingEntries = { // Go: mmodel.AccountingEntries
  direct?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  hold?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  commit?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  cancel?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  revert?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  overdraft?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  block?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
  unblock?: AccountingEntry // *AccountingEntry; wire null: false; omitempty: true
}

type AccountRule = { // Go: mmodel.AccountRule
  ruleType?: string // string; wire null: false; omitempty: true
  validIf?: unknown // any; wire null: false; omitempty: true
}

type TransactionGroupPart = { // Go: events.TransactionGroupPart
  transactionId: string // string; wire null: false; omitempty: false
  organizationId: string // string; wire null: false; omitempty: false
  ledgerId: string // string; wire null: false; omitempty: false
  role: string // string; wire null: false; omitempty: false
  status: string // string; wire null: false; omitempty: false
}
```

> [accordion] account.closed
>
> **Evento:** `studio.lerian.ledger.account.closed`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** o encerramento de uma conta. `closedAt` é o instante do encerramento.
>
> **Subject:** ID da conta (`p.ID`)
>
> ```typescript theme={null}
> // account.closed
> type AccountClosedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   closedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] account.created
>
> **Evento:** `studio.lerian.ledger.account.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a abertura de uma conta em um ledger.
>
> **Subject:** ID da conta (`p.ID`)
>
> ```typescript theme={null}
> type AccountStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // account.created
> type AccountCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   portfolioId: string | null // *string; wire null: true; omitempty: false
>   segmentId: string | null // *string; wire null: true; omitempty: false
>   parentAccountId: string | null // *string; wire null: true; omitempty: false
>   entityId: string | null // *string; wire null: true; omitempty: false
>   holderId: string | null // *string; wire null: true; omitempty: false
>   alias: string | null // *string; wire null: true; omitempty: false
>   status: AccountStatusPayload // AccountStatusPayload; wire null: false; omitempty: false
>   blocked: boolean | null // *bool; wire null: true; omitempty: false
>   holderCheckSkipped: boolean // bool; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] account.deleted
>
> **Evento:** `studio.lerian.ledger.account.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de uma conta.
>
> **Subject:** ID da conta (`p.ID`)
>
> ```typescript theme={null}
> // account.deleted
> type AccountDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   portfolioId: string | null // *string; wire null: true; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] account.updated
>
> **Evento:** `studio.lerian.ledger.account.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de uma conta mudam.
>
> **Subject:** ID da conta (`p.ID`)
>
> ```typescript theme={null}
> type AccountStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // account.updated
> type AccountUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   portfolioId: string | null // *string; wire null: true; omitempty: false
>   segmentId: string | null // *string; wire null: true; omitempty: false
>   entityId: string | null // *string; wire null: true; omitempty: false
>   status: AccountStatusPayload // AccountStatusPayload; wire null: false; omitempty: false
>   blocked: boolean | null // *bool; wire null: true; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] asset.created
>
> **Evento:** `studio.lerian.ledger.asset.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** o registro de um ativo em um ledger.
>
> **Subject:** ID do ativo (`p.ID`)
>
> ```typescript theme={null}
> type AssetStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // asset.created
> type AssetCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   code: string // string; wire null: false; omitempty: false
>   status: AssetStatusPayload // AssetStatusPayload; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] asset.deleted
>
> **Evento:** `studio.lerian.ledger.asset.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um ativo.
>
> **Subject:** ID do ativo (`p.ID`)
>
> ```typescript theme={null}
> // asset.deleted
> type AssetDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] asset.updated
>
> **Evento:** `studio.lerian.ledger.asset.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um ativo mudam.
>
> **Subject:** ID do ativo (`p.ID`)
>
> ```typescript theme={null}
> type AssetStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // asset.updated
> type AssetUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   code: string // string; wire null: false; omitempty: false
>   status: AssetStatusPayload // AssetStatusPayload; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.changed
>
> **Evento:** `studio.lerian.ledger.balance.changed`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Uma transação commitada movimenta um saldo (um evento por operação que afeta o saldo). Os valores refletem o estado após a operação.
>
> **Subject:** ID da transação e ID da operação (`p.TransactionID + ":" + p.OperationID`)
>
> ```typescript theme={null}
> // balance.changed
> type BalanceChangedDataV1 = {
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   balanceId: string // string; wire null: false; omitempty: false
>   alias?: string // string; wire null: false; omitempty: true
>   assetCode: string // string; wire null: false; omitempty: false
>   balanceKey: string // string; wire null: false; omitempty: false
>   available: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   onHold: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   version: number // int64; wire null: false; omitempty: false
>   reason: string // string; wire null: false; omitempty: false
>   operationType: string // string; wire null: false; omitempty: false
>   direction?: string // string; wire null: false; omitempty: true
>   amount: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   transactionId: string // string; wire null: false; omitempty: false
>   operationId: string // string; wire null: false; omitempty: false
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.config\_changed
>
> **Evento:** `studio.lerian.ledger.balance.config_changed`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** As configurações de um saldo mudam, ou o overdraft é habilitado (saldo complementar materializado). `changeType` diferencia `settings_updated` de `overdraft_enabled`.
>
> **Subject:** ID do saldo (`p.ID`)
>
> ```typescript theme={null}
> // balance.config_changed
> type BalanceConfigChangedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   alias?: string // string; wire null: false; omitempty: true
>   key: string // string; wire null: false; omitempty: false
>   allowSending: boolean // bool; wire null: false; omitempty: false
>   allowReceiving: boolean // bool; wire null: false; omitempty: false
>   direction?: string // string; wire null: false; omitempty: true
>   settings?: BalanceSettings // *mmodel.BalanceSettings; wire null: false; omitempty: true
>   changeType: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.created
>
> **Evento:** `studio.lerian.ledger.balance.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Subject:** ID do saldo (`p.ID`)
>
> ```typescript theme={null}
> // balance.created
> type BalanceCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   alias?: string // string; wire null: false; omitempty: true
>   key: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   accountType?: string // string; wire null: false; omitempty: true
>   available: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   onHold: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   allowSending: boolean // bool; wire null: false; omitempty: false
>   allowReceiving: boolean // bool; wire null: false; omitempty: false
>   direction?: string // string; wire null: false; omitempty: true
>   settings?: BalanceSettings // *mmodel.BalanceSettings; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.deleted
>
> **Evento:** `studio.lerian.ledger.balance.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um saldo.
>
> **Subject:** ID do saldo (`p.ID`)
>
> ```typescript theme={null}
> // balance.deleted
> type BalanceDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.overdraft\_cleared
>
> **Evento:** `studio.lerian.ledger.balance.overdraft_cleared`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** O overdraft é totalmente quitado, um sinal terminal (`action` = `cleared`).
>
> **Subject:** ID da transação e ID da operação (`p.TransactionID + ":" + p.OperationID`)
>
> ```typescript theme={null}
> // balance.overdraft_cleared
> type BalanceOverdraftClearedDataV1 = {
>   balanceId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   transactionId: string // string; wire null: false; omitempty: false
>   operationId: string // string; wire null: false; omitempty: false
>   action: string // string; wire null: false; omitempty: false
>   amount: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftBalance: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftLimit?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.overdraft\_drawn
>
> **Evento:** `studio.lerian.ledger.balance.overdraft_drawn`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Um débito consome overdraft além dos fundos disponíveis (`action` = `drawn`).
>
> **Subject:** ID da transação e ID da operação (`p.TransactionID + ":" + p.OperationID`)
>
> ```typescript theme={null}
> // balance.overdraft_drawn
> type BalanceOverdraftDrawnDataV1 = {
>   balanceId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   transactionId: string // string; wire null: false; omitempty: false
>   operationId: string // string; wire null: false; omitempty: false
>   action: string // string; wire null: false; omitempty: false
>   amount: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftBalance: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftLimit?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] balance.overdraft\_repaid
>
> **Evento:** `studio.lerian.ledger.balance.overdraft_repaid`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** O uso do overdraft diminui, mas não é totalmente quitado (`action` = `repaid`).
>
> **Subject:** ID da transação e ID da operação (`p.TransactionID + ":" + p.OperationID`)
>
> ```typescript theme={null}
> // balance.overdraft_repaid
> type BalanceOverdraftRepaidDataV1 = {
>   balanceId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   transactionId: string // string; wire null: false; omitempty: false
>   operationId: string // string; wire null: false; omitempty: false
>   action: string // string; wire null: false; omitempty: false
>   amount: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftBalance: DecimalString // decimal.Decimal; wire null: false; omitempty: false
>   overdraftLimit?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_billing\_packages.created
>
> **Evento:** `studio.lerian.ledger.fee_billing_packages.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um pacote de cobrança.
>
> **Subject:** ID do pacote de cobrança (`p.ID`)
>
> ```typescript theme={null}
> // fee_billing_packages.created
> type FeeBillingPackagesCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   pricingModel: string | null // *string; wire null: true; omitempty: false
>   countMode: string | null // *string; wire null: true; omitempty: false
>   enable: boolean // bool; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_billing\_packages.deleted
>
> **Evento:** `studio.lerian.ledger.fee_billing_packages.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um pacote de cobrança.
>
> **Subject:** ID do pacote de cobrança (`p.ID`)
>
> ```typescript theme={null}
> // fee_billing_packages.deleted
> type FeeBillingPackagesDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_billing\_packages.updated
>
> **Evento:** `studio.lerian.ledger.fee_billing_packages.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um pacote de cobrança mudam.
>
> **Subject:** ID do pacote de cobrança (`p.ID`)
>
> ```typescript theme={null}
> // fee_billing_packages.updated
> type FeeBillingPackagesUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   pricingModel: string | null // *string; wire null: true; omitempty: false
>   countMode: string | null // *string; wire null: true; omitempty: false
>   enable: boolean // bool; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_charge.applied
>
> **Evento:** `studio.lerian.ledger.fee_charge.applied`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a aplicação de um pacote de tarifas a uma transação commitada.
>
> **Subject:** ID da transação (`p.TransactionID`)
>
> ```typescript theme={null}
> // fee_charge.applied
> type FeeChargeAppliedDataV1 = {
>   transactionId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   feePackageId: string // string; wire null: false; omitempty: false
>   appliedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_packages.created
>
> **Evento:** `studio.lerian.ledger.fee_packages.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um pacote de tarifas.
>
> **Subject:** ID do pacote de tarifas (`p.ID`)
>
> ```typescript theme={null}
> // fee_packages.created
> type FeePackagesCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   segmentId: string | null // *string; wire null: true; omitempty: false
>   transactionRoute: string | null // *string; wire null: true; omitempty: false
>   enable: boolean // bool; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_packages.deleted
>
> **Evento:** `studio.lerian.ledger.fee_packages.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um pacote de tarifas.
>
> **Subject:** ID do pacote de tarifas (`p.ID`)
>
> ```typescript theme={null}
> // fee_packages.deleted
> type FeePackagesDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] fee\_packages.updated
>
> **Evento:** `studio.lerian.ledger.fee_packages.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um pacote de tarifas mudam.
>
> **Subject:** ID do pacote de tarifas (`p.ID`)
>
> ```typescript theme={null}
> // fee_packages.updated
> type FeePackagesUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   segmentId: string | null // *string; wire null: true; omitempty: false
>   transactionRoute: string | null // *string; wire null: true; omitempty: false
>   enable: boolean // bool; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] holder.created
>
> **Evento:** `studio.lerian.ledger.holder.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um holder.
>
> **Subject:** ID do holder (`p.ID`)
>
> ```typescript theme={null}
> // holder.created
> type HolderCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   externalId: string | null // *string; wire null: true; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] holder.deleted
>
> **Evento:** `studio.lerian.ledger.holder.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um holder.
>
> **Subject:** ID do holder (`p.ID`)
>
> ```typescript theme={null}
> // holder.deleted
> type HolderDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   deletionType: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] holder.updated
>
> **Evento:** `studio.lerian.ledger.holder.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um holder mudam.
>
> **Subject:** ID do holder (`p.ID`)
>
> ```typescript theme={null}
> // holder.updated
> type HolderUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   externalId: string | null // *string; wire null: true; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] instrument.created
>
> **Evento:** `studio.lerian.ledger.instrument.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um instrumento para um holder e uma conta.
>
> **Subject:** ID do instrumento (`p.ID`)
>
> ```typescript theme={null}
> type InstrumentRelatedPartyPayload = {
>   relatedPartyId: string // string; wire null: false; omitempty: false
>   role: string // string; wire null: false; omitempty: false
> }
>
> // instrument.created
> type InstrumentCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   holderId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
>   relatedParties: InstrumentRelatedPartyPayload[] | null // []InstrumentRelatedPartyPayload; wire null: true; omitempty: false
> }
> ```

> [accordion] instrument.deleted
>
> **Evento:** `studio.lerian.ledger.instrument.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um instrumento.
>
> **Subject:** ID do instrumento (`p.ID`)
>
> ```typescript theme={null}
> // instrument.deleted
> type InstrumentDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   holderId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   deletionType: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] instrument.related\_party\_deleted
>
> **Evento:** `studio.lerian.ledger.instrument.related_party_deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a remoção de uma única parte relacionada de um instrumento (`ce-subject` é o id do instrumento).
>
> **Subject:** ID do instrumento (`p.InstrumentID`)
>
> ```typescript theme={null}
> // instrument.related_party_deleted
> type InstrumentRelatedPartyDeletedDataV1 = {
>   instrumentId: string // string; wire null: false; omitempty: false
>   holderId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   relatedPartyId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] instrument.updated
>
> **Evento:** `studio.lerian.ledger.instrument.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um instrumento mudam.
>
> **Subject:** ID do instrumento (`p.ID`)
>
> ```typescript theme={null}
> type InstrumentRelatedPartyPayload = {
>   relatedPartyId: string // string; wire null: false; omitempty: false
>   role: string // string; wire null: false; omitempty: false
> }
>
> // instrument.updated
> type InstrumentUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   holderId: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   accountId: string // string; wire null: false; omitempty: false
>   type: string // string; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
>   relatedParties: InstrumentRelatedPartyPayload[] | null // []InstrumentRelatedPartyPayload; wire null: true; omitempty: false
> }
> ```

> [accordion] ledger.created
>
> **Evento:** `studio.lerian.ledger.ledger.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um ledger dentro de uma organização.
>
> **Subject:** ID do ledger (`p.ID`)
>
> ```typescript theme={null}
> type LedgerStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // ledger.created
> type LedgerCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   status: LedgerStatusPayload // LedgerStatusPayload; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] ledger.deleted
>
> **Evento:** `studio.lerian.ledger.ledger.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um ledger.
>
> **Subject:** ID do ledger (`p.ID`)
>
> ```typescript theme={null}
> // ledger.deleted
> type LedgerDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] ledger.updated
>
> **Evento:** `studio.lerian.ledger.ledger.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** O nome ou o status de um ledger muda.
>
> **Subject:** ID do ledger (`p.ID`)
>
> ```typescript theme={null}
> type LedgerStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // ledger.updated
> type LedgerUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   status: LedgerStatusPayload // LedgerStatusPayload; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] operation\_route.created
>
> **Evento:** `studio.lerian.ledger.operation_route.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.1.0`
>
> **Disparado quando:** a criação de uma rota de operação.
>
> **Subject:** ID da rota de operação (`p.ID`)
>
> ```typescript theme={null}
> // operation_route.created
> type OperationRouteCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   title: string // string; wire null: false; omitempty: false
>   description?: string // string; wire null: false; omitempty: true
>   code?: string // string; wire null: false; omitempty: true
>   operationType: string // string; wire null: false; omitempty: false
>   account?: AccountRule // *mmodel.AccountRule; wire null: false; omitempty: true
>   accountingEntries?: AccountingEntries // *mmodel.AccountingEntries; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] operation\_route.deleted
>
> **Evento:** `studio.lerian.ledger.operation_route.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.1.0`
>
> **Disparado quando:** a exclusão de uma rota de operação.
>
> **Subject:** ID da rota de operação (`p.ID`)
>
> ```typescript theme={null}
> // operation_route.deleted
> type OperationRouteDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] operation\_route.updated
>
> **Evento:** `studio.lerian.ledger.operation_route.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.1.0`
>
> **Disparado quando:** Os campos mutáveis de uma rota de operação mudam.
>
> **Subject:** ID da rota de operação (`p.ID`)
>
> ```typescript theme={null}
> // operation_route.updated
> type OperationRouteUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   title: string // string; wire null: false; omitempty: false
>   description?: string // string; wire null: false; omitempty: true
>   code?: string // string; wire null: false; omitempty: true
>   operationType: string // string; wire null: false; omitempty: false
>   account?: AccountRule // *mmodel.AccountRule; wire null: false; omitempty: true
>   accountingEntries?: AccountingEntries // *mmodel.AccountingEntries; wire null: false; omitempty: true
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] organization.created
>
> **Evento:** `studio.lerian.ledger.organization.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de uma organização.
>
> **Subject:** ID da organização (`p.ID`)
>
> ```typescript theme={null}
> type OrganizationAddressPayload = {
>   line1: string // string; wire null: false; omitempty: false
>   line2: string | null // *string; wire null: true; omitempty: false
>   zipCode: string // string; wire null: false; omitempty: false
>   city: string // string; wire null: false; omitempty: false
>   state: string // string; wire null: false; omitempty: false
>   country: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> type OrganizationStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // organization.created
> type OrganizationCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentOrganizationId: string | null // *string; wire null: true; omitempty: false
>   legalName: string // string; wire null: false; omitempty: false
>   doingBusinessAs: string | null // *string; wire null: true; omitempty: false
>   legalDocument: string // string; wire null: false; omitempty: false
>   address: OrganizationAddressPayload // OrganizationAddressPayload; wire null: false; omitempty: false
>   status: OrganizationStatusPayload // OrganizationStatusPayload; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] organization.deleted
>
> **Evento:** `studio.lerian.ledger.organization.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de uma organização.
>
> **Subject:** ID da organização (`p.ID`)
>
> ```typescript theme={null}
> // organization.deleted
> type OrganizationDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] organization.updated
>
> **Evento:** `studio.lerian.ledger.organization.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de uma organização mudam.
>
> **Subject:** ID da organização (`p.ID`)
>
> ```typescript theme={null}
> type OrganizationAddressPayload = {
>   line1: string // string; wire null: false; omitempty: false
>   line2: string | null // *string; wire null: true; omitempty: false
>   zipCode: string // string; wire null: false; omitempty: false
>   city: string // string; wire null: false; omitempty: false
>   state: string // string; wire null: false; omitempty: false
>   country: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> type OrganizationStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // organization.updated
> type OrganizationUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentOrganizationId: string | null // *string; wire null: true; omitempty: false
>   legalName: string // string; wire null: false; omitempty: false
>   doingBusinessAs: string | null // *string; wire null: true; omitempty: false
>   address: OrganizationAddressPayload // OrganizationAddressPayload; wire null: false; omitempty: false
>   status: OrganizationStatusPayload // OrganizationStatusPayload; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] portfolio.created
>
> **Evento:** `studio.lerian.ledger.portfolio.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um portfólio.
>
> **Subject:** ID do portfólio (`p.ID`)
>
> ```typescript theme={null}
> type PortfolioStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // portfolio.created
> type PortfolioCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   entityId?: string // string; wire null: false; omitempty: true
>   status: PortfolioStatusPayload // PortfolioStatusPayload; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] portfolio.deleted
>
> **Evento:** `studio.lerian.ledger.portfolio.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um portfólio.
>
> **Subject:** ID do portfólio (`p.ID`)
>
> ```typescript theme={null}
> // portfolio.deleted
> type PortfolioDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] portfolio.updated
>
> **Evento:** `studio.lerian.ledger.portfolio.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um portfólio mudam.
>
> **Subject:** ID do portfólio (`p.ID`)
>
> ```typescript theme={null}
> type PortfolioStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // portfolio.updated
> type PortfolioUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   entityId?: string // string; wire null: false; omitempty: true
>   status: PortfolioStatusPayload // PortfolioStatusPayload; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] segment.created
>
> **Evento:** `studio.lerian.ledger.segment.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a criação de um segmento.
>
> **Subject:** ID do segmento (`p.ID`)
>
> ```typescript theme={null}
> type SegmentStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // segment.created
> type SegmentCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   status: SegmentStatusPayload // SegmentStatusPayload; wire null: false; omitempty: false
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] segment.deleted
>
> **Evento:** `studio.lerian.ledger.segment.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** a exclusão de um segmento.
>
> **Subject:** ID do segmento (`p.ID`)
>
> ```typescript theme={null}
> // segment.deleted
> type SegmentDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] segment.updated
>
> **Evento:** `studio.lerian.ledger.segment.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Os campos mutáveis de um segmento mudam.
>
> **Subject:** ID do segmento (`p.ID`)
>
> ```typescript theme={null}
> type SegmentStatusPayload = {
>   code: string // string; wire null: false; omitempty: false
>   description?: string // *string; wire null: false; omitempty: true
> }
>
> // segment.updated
> type SegmentUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   name: string // string; wire null: false; omitempty: false
>   status: SegmentStatusPayload // SegmentStatusPayload; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction.canceled
>
> **Evento:** `studio.lerian.ledger.transaction.canceled`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Uma transação pendente faz a transição de `PENDING` para `CANCELED`.
>
> **Subject:** ID da transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction.canceled
> type TransactionCanceledDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentTransactionId?: string // *string; wire null: false; omitempty: true
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   status: MmodelStatus // mmodel.Status; wire null: false; omitempty: false
>   amount?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   assetCode: string // string; wire null: false; omitempty: false
>   chartOfAccountsGroupName?: string // string; wire null: false; omitempty: true
>   description?: string // string; wire null: false; omitempty: true
>   source?: string[] // []string; wire null: false; omitempty: true
>   destination?: string[] // []string; wire null: false; omitempty: true
>   route?: string // string; wire null: false; omitempty: true
>   routeId?: string // *string; wire null: false; omitempty: true
>   operations: JsonRawMessage[] // []json.RawMessage; wire null: false; omitempty: false
>   metadata?: Record<string, unknown> // map[string]any; wire null: false; omitempty: true
>   feesSkipped: boolean // bool; wire null: false; omitempty: false
>   tracerSkipped: boolean // bool; wire null: false; omitempty: false
>   scheme?: string // string; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction.committed
>
> **Evento:** `studio.lerian.ledger.transaction.committed`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Uma transação pendente faz a transição de `PENDING` para `APPROVED`.
>
> **Subject:** ID da transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction.committed
> type TransactionCommittedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentTransactionId?: string // *string; wire null: false; omitempty: true
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   status: MmodelStatus // mmodel.Status; wire null: false; omitempty: false
>   amount?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   assetCode: string // string; wire null: false; omitempty: false
>   chartOfAccountsGroupName?: string // string; wire null: false; omitempty: true
>   description?: string // string; wire null: false; omitempty: true
>   source?: string[] // []string; wire null: false; omitempty: true
>   destination?: string[] // []string; wire null: false; omitempty: true
>   route?: string // string; wire null: false; omitempty: true
>   routeId?: string // *string; wire null: false; omitempty: true
>   operations: JsonRawMessage[] // []json.RawMessage; wire null: false; omitempty: false
>   metadata?: Record<string, unknown> // map[string]any; wire null: false; omitempty: true
>   feesSkipped: boolean // bool; wire null: false; omitempty: false
>   tracerSkipped: boolean // bool; wire null: false; omitempty: false
>   scheme?: string // string; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction.posted
>
> **Evento:** `studio.lerian.ledger.transaction.posted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** o commit de uma transação recém-criada no armazenamento, com todas as suas operações persistidas (sem transação pai).
>
> **Subject:** ID da transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction.posted
> type TransactionPostedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentTransactionId?: string // *string; wire null: false; omitempty: true
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   status: MmodelStatus // mmodel.Status; wire null: false; omitempty: false
>   amount?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   assetCode: string // string; wire null: false; omitempty: false
>   chartOfAccountsGroupName?: string // string; wire null: false; omitempty: true
>   description?: string // string; wire null: false; omitempty: true
>   source?: string[] // []string; wire null: false; omitempty: true
>   destination?: string[] // []string; wire null: false; omitempty: true
>   route?: string // string; wire null: false; omitempty: true
>   routeId?: string // *string; wire null: false; omitempty: true
>   operations: JsonRawMessage[] // []json.RawMessage; wire null: false; omitempty: false
>   metadata?: Record<string, unknown> // map[string]any; wire null: false; omitempty: true
>   feesSkipped: boolean // bool; wire null: false; omitempty: false
>   tracerSkipped: boolean // bool; wire null: false; omitempty: false
>   scheme?: string // string; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction.reverted
>
> **Evento:** `studio.lerian.ledger.transaction.reverted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Um fluxo de estorno cria uma transação filha. `parentTransactionId` a correlaciona com a original.
>
> **Subject:** ID da transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction.reverted
> type TransactionRevertedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   parentTransactionId?: string // *string; wire null: false; omitempty: true
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId: string // string; wire null: false; omitempty: false
>   status: MmodelStatus // mmodel.Status; wire null: false; omitempty: false
>   amount?: DecimalString // *decimal.Decimal; wire null: false; omitempty: true
>   assetCode: string // string; wire null: false; omitempty: false
>   chartOfAccountsGroupName?: string // string; wire null: false; omitempty: true
>   description?: string // string; wire null: false; omitempty: true
>   source?: string[] // []string; wire null: false; omitempty: true
>   destination?: string[] // []string; wire null: false; omitempty: true
>   route?: string // string; wire null: false; omitempty: true
>   routeId?: string // *string; wire null: false; omitempty: true
>   operations: JsonRawMessage[] // []json.RawMessage; wire null: false; omitempty: false
>   metadata?: Record<string, unknown> // map[string]any; wire null: false; omitempty: true
>   feesSkipped: boolean // bool; wire null: false; omitempty: false
>   tracerSkipped: boolean // bool; wire null: false; omitempty: false
>   scheme?: string // string; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_group.canceled
>
> **Evento:** `studio.lerian.ledger.transaction_group.canceled`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Um grupo cross-ledger pendente é cancelado.
>
> **Subject:** ID do grupo (`p.GroupID`)
>
> ```typescript theme={null}
> // transaction_group.canceled
> type TransactionGroupCanceledDataV1 = {
>   groupId: string // string; wire null: false; omitempty: false
>   revertedGroupId?: string // *string; wire null: false; omitempty: true
>   status: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   ledgerCount: number // int; wire null: false; omitempty: false
>   parts: TransactionGroupPart[] // []events.TransactionGroupPart; wire null: false; omitempty: false
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_group.committed
>
> **Evento:** `studio.lerian.ledger.transaction_group.committed`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Um grupo cross-ledger pendente é confirmado.
>
> **Subject:** ID do grupo (`p.GroupID`)
>
> ```typescript theme={null}
> // transaction_group.committed
> type TransactionGroupCommittedDataV1 = {
>   groupId: string // string; wire null: false; omitempty: false
>   revertedGroupId?: string // *string; wire null: false; omitempty: true
>   status: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   ledgerCount: number // int; wire null: false; omitempty: false
>   parts: TransactionGroupPart[] // []events.TransactionGroupPart; wire null: false; omitempty: false
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_group.posted
>
> **Evento:** `studio.lerian.ledger.transaction_group.posted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Uma transação cross-ledger direta é concluída. `parts` lista as transações do grupo.
>
> **Subject:** ID do grupo (`p.GroupID`)
>
> ```typescript theme={null}
> // transaction_group.posted
> type TransactionGroupPostedDataV1 = {
>   groupId: string // string; wire null: false; omitempty: false
>   revertedGroupId?: string // *string; wire null: false; omitempty: true
>   status: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   ledgerCount: number // int; wire null: false; omitempty: false
>   parts: TransactionGroupPart[] // []events.TransactionGroupPart; wire null: false; omitempty: false
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_group.reverted
>
> **Evento:** `studio.lerian.ledger.transaction_group.reverted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.0.0`
>
> **Disparado quando:** Um grupo cross-ledger é estornado. `groupId` identifica o novo grupo e `revertedGroupId` identifica o original.
>
> **Subject:** ID do grupo (`p.GroupID`)
>
> ```typescript theme={null}
> // transaction_group.reverted
> type TransactionGroupRevertedDataV1 = {
>   groupId: string // string; wire null: false; omitempty: false
>   revertedGroupId?: string // *string; wire null: false; omitempty: true
>   status: string // string; wire null: false; omitempty: false
>   assetCode: string // string; wire null: false; omitempty: false
>   ledgerCount: number // int; wire null: false; omitempty: false
>   parts: TransactionGroupPart[] // []events.TransactionGroupPart; wire null: false; omitempty: false
>   occurredAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_route.created
>
> **Evento:** `studio.lerian.ledger.transaction_route.created`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.2.0`
>
> **Disparado quando:** a criação de uma rota de transação.
>
> **Subject:** ID da rota de transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction_route.created
> type TransactionRouteCreatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   title: string // string; wire null: false; omitempty: false
>   description?: string // string; wire null: false; omitempty: true
>   operationRouteIds?: string[] // []string; wire null: false; omitempty: true
>   optionalOperationRouteIds?: string[] // []string; wire null: false; omitempty: true
>   createdAt: string // string; wire null: false; omitempty: false
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_route.deleted
>
> **Evento:** `studio.lerian.ledger.transaction_route.deleted`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.1.0`
>
> **Disparado quando:** a exclusão de uma rota de transação.
>
> **Subject:** ID da rota de transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction_route.deleted
> type TransactionRouteDeletedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   deletedAt: string // string; wire null: false; omitempty: false
> }
> ```

> [accordion] transaction\_route.updated
>
> **Evento:** `studio.lerian.ledger.transaction_route.updated`
>
> **Tópico:** `lerian.streaming.ledger`
>
> **Rota DLQ:** `lerian.streaming.ledger.dlq`
>
> **Schema:** `1.2.0`
>
> **Disparado quando:** Os campos mutáveis de uma rota de transação mudam.
>
> **Subject:** ID da rota de transação (`p.ID`)
>
> ```typescript theme={null}
> // transaction_route.updated
> type TransactionRouteUpdatedDataV1 = {
>   id: string // string; wire null: false; omitempty: false
>   organizationId: string // string; wire null: false; omitempty: false
>   ledgerId?: string // string; wire null: false; omitempty: true
>   title: string // string; wire null: false; omitempty: false
>   description?: string // string; wire null: false; omitempty: true
>   operationRouteIds?: string[] // []string; wire null: false; omitempty: true
>   optionalOperationRouteIds?: string[] // []string; wire null: false; omitempty: true
>   updatedAt: string // string; wire null: false; omitempty: false
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.