# Dicionário de dados do Core Monetarie (mon_core)

Data: 2026-07-10. Gerado por leitura direta dos Ecto schemas (`grep 'schema "' core/backend/lib`, 366 blocos, 364 tabelas distintas), das migrations em `core/backend/priv/repo/migrations` (296 arquivos) e do baseline `core/backend/priv/repo/sql/mon_core_schema_clean.sql` (carregado pela migration `20260101000000_create_schema.exs`). Banco: Aurora PostgreSQL, database `mon_core`, repo Ecto `Monetarie.Infra.Repo.Base` com wrapper de auditoria `Monetarie.Repo` (`core/backend/lib/monetarie/repo.ex`).

Convenções:

- Tipos são os tipos Ecto declarados no schema. Unidade monetária de colunas `:integer` NÃO é uniforme: `account_entries.amount` e `transactions.amount` guardam SUBCENTAVOS (BRL x 10.000, mesma unidade do TigerBeetle, `Monetarie.Util.MoneyUnit` com `@scale 100` sobre centavos); `fee_transactions.fee_amount` e `spb_inbound_credits.amount_cents` guardam CENTAVOS. Confira o módulo dono antes de usar (ver seção de unidades no documento de arquitetura).
- PK: `binary_id` = UUID; tabelas legadas do ETL AutBank usam `:integer` sem autogeneração; `:binary` cru = ID de 16 bytes (TigerBeetle/legado).
- `timestamps` = `inserted_at`/`updated_at` (o tipo aparece quando declarado).
- Índices e FKs vêm das migrations quando a tabela foi criada por migration, ou do baseline SQL quando veio do dump. Tabelas particionadas indicadas.
- Tabelas sem schema Ecto (criadas só por migration/baseline, acessadas via SQL) estão incluídas nas seções com a marca (sem schema Ecto).

Total de tabelas documentadas: **398** (364 com schema Ecto + 34 sem schema Ecto).

## Sumário por domínio

| Domínio | Tabelas |
|---|---|
| 1. Contas, carteiras e lançamentos | 18 |
| 2. Clientes, entidades e onboarding | 13 |
| 3. Transações e pagamentos (PIX, TED/SPB, boleto, cheque, DDA) | 41 |
| 4. Tarifas e faturamento | 15 |
| 5. Compliance, PLD/FT, LGPD e judicial | 21 |
| 6. Admin, autenticação, RBAC e auditoria | 14 |
| 7. Webhooks, eventos e infraestrutura de mensageria | 6 |
| 8. Partner API, tenants BaaS e merchants | 14 |
| 9. Contabilidade COSIF e patrimônio | 12 |
| 10. Crédito (empréstimos, consignado, desconto, provisão) | 56 |
| 11. Investimentos, captação e títulos | 38 |
| 12. Tesouraria, liquidez, câmbio e meio circulante | 29 |
| 13. Cooperativa (legado societário) | 22 |
| 14. Regulatório BACEN/RFB (SCR, e-Financeira, CADOC, CCS, DERE, RC6 e afins) | 63 |
| 15. Canais, cartões e serviços ao cliente | 8 |
| 16. Demais módulos (analytics, comunicação, corporativo, dados mestres) | 28 |

## 1. Contas, carteiras e lançamentos

### `account_balance_checkpoints` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260704140000_create_account_balance_checkpoints.exs`
- Propósito: Checkpoints de saldo por conta usados pelo BalanceGuard quando a flag BALANCE_CHECKPOINT_ENABLED está ligada, evitando varrer o histórico completo.
- Colunas: `account_id` :integer; `through_day` :date; `credits` :bigint; `debits` :bigint; `fees` :bigint
- Índices/chaves: index [:through_day]

### `account_daily_summaries` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260314220000_create_account_daily_summaries.exs`
- Propósito: Resumo diário de movimentação por conta que complementa o checkpoint de saldo (delta do dia sobre o último checkpoint).
- Colunas: `account_id` :integer; `day` :date; `type` :string; `direction` :string; `bucket` :smallint; `amount_cents` :bigint; `count` :integer
- Índices/chaves: unique [:account_id, :day, :type, :direction, :bucket]; index [:day]; index [:account_id]

### `account_entries`
- Módulo: `Monetarie.Schemas.Accounts.AccountEntry` (`core/backend/lib/monetarie/schemas/accounts/account_entry.ex:30`)
- Propósito: Extrato da conta em Postgres: lançamentos manuais e espelho das liquidações PIX, SPB e tarifas; valor em subcentavos com sinal.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime); particionada por RANGE mensal (`account_entries_partitioned`, migration `20260503*`/`20260704120000`)
- Colunas: `account_id` :integer; `entry_date` :date; `value_date` :date; `amount` :integer; `description` :string; `category` :string; `reference` :string; `counterpart_account_id` :integer; `batch_id` :binary_id; `status` :string (default: "confirmed"); `performed_by` :binary_id; `performed_by_name` :string; `notes` :string; `metadata` :map (default: %{}); `reversed_entry_id` belongs_to `__MODULE__`
- Índices/chaves: index [account_id, entry_date]; index [account_id, status]; index [batch_id]; index [reversed_entry_id]; FK `account_id` → `accounts`; FK `reversed_entry_id` → `account_entries`

### `account_entry_types`
- Módulo: `Monetarie.Schemas.Accounts.AccountEntryType` (`core/backend/lib/monetarie/schemas/accounts/account_entry_type.ex:10`)
- Propósito: Cadastro dos tipos de lançamento contábil (débito/crédito) aplicáveis a contas, com categoria e conta de contrapartida vinculada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `category` :string; `counterpart_account` :string; `active` :boolean (default: true)
- Índices/chaves: index [:category]; index [:category, :active]

### `account_holders`
- Módulo: `Monetarie.Schemas.Accounts.AccountHolder` (`core/backend/lib/monetarie/schemas/accounts/account_holder.ex:10`)
- Propósito: Registra os titulares e cotitulares de uma conta, com tipo de documento, permissões de acesso e status de atividade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer  # bigint FK to accounts.id; `document_type` :string; `document_number` :string; `name` :string; `holder_type` :string; `permissions` :map (default: %{}); `is_active` :boolean (default: true); `metadata` :map (default: %{}); `tenant_id` :binary_id
- Índices/chaves: unique [account_id, document_number]; index [account_id]; index [document_number]; index [tenant_id]

### `account_products`
- Módulo: `Monetarie.Schemas.Accounts.AccountProduct` (`core/backend/lib/monetarie/schemas/accounts/account_product.ex:11`)
- Propósito: Catálogo de produtos de conta oferecidos pela instituição, com tipo, tarifas, limites, impostos e regras de juros.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `account_type` :string; `holder_type` :string; `features` :map (default: %{}); `limits` :map (default: %{}); `tariffs` :map (default: %{}); `taxes` :map (default: %{}); `interest_rules` :map (default: %{}); `is_active` :boolean (default: true); `metadata` :map (default: %{}); `tenant_id` :binary_id
- Índices/chaves: index [account_type]; unique [code]; index [tenant_id]

### `account_status_rules`
- Módulo: `Monetarie.Schemas.Accounts.AccountStatusRule` (`core/backend/lib/monetarie/schemas/accounts/account_status_rule.ex:8`)
- Propósito: Regras de transição de status de conta, definindo estados iniciais, finais e transições permitidas com exigência de aprovação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `kind` :string; `status` :string; `is_initial` :boolean (default: false); `is_final` :boolean (default: false); `can_transition_to` {:array, :string} (default: []); `requires_approval` :boolean (default: false)
- Índices/chaves: unique [:kind, :status]; index [:kind]

### `account_tariff_charges`
- Módulo: `Monetarie.Schemas.Accounts.TariffCharge` (`core/backend/lib/monetarie/schemas/accounts/tariff_charge.ex:10`)
- Propósito: Cobranças de tarifas bancárias por conta, com tipo, valor, mês de referência, status e motivo de estorno.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer  # bigint FK to accounts.id; `tariff_type` :string; `amount` :integer      # centavos; `charged_at` :utc_datetime; `reference_month` :date; `status` :string (default: "charged"); `reversal_reason` :string; `tb_transfer_id` :string; `metadata` :map (default: %{}); `tenant_id` :binary_id
- Índices/chaves: index [account_id]; index [charged_at]; index [tariff_type]; index [tenant_id]

### `accounts`
- Módulo: `Monetarie.Schemas.Relational.Account` (`core/backend/lib/monetarie/schemas/relational/account.ex:54`)
- Propósito: Conta corrente ou de depósito do core bancário, com agência, número, tipo, produto, limites e configurações de PIX.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`; timestamps (type: :utc_datetime)
- Colunas: `kind` :integer; `agency` :string; `account_number` :string; `status` :string (default: "active"); `account_type` :string; `entity_id` Ecto.UUID; `product_id` Ecto.UUID; `daily_limit` :integer; `monthly_limit` :integer; `friendly_name` :string; `accept_pix_in_without_txid` :boolean; `pix_out_transaction_limit` :integer; `pix_out_daily_limit` :integer; `pix_out_monthly_limit` :integer; `nighttime_limit` :integer; `check_digit` :string; `iban` :string; `pix_in_transaction_limit` :integer; `pix_in_daily_limit` :integer; `pix_in_monthly_limit` :integer; `is_primary` :boolean (default: false); `merchant_id` Ecto.UUID; `salary_account` :boolean (default: false); `cosif_account_code` :string (default: "4.9.8.10.01.10.002"); `closing_date` :date; `user_id` belongs_to `Monetarie.Schemas.Relational.User`; `bank_id` belongs_to `Monetarie.Schemas.Relational.Bank`
- Índices/chaves: unique [:iban]; FK `entity_id` → `entities`; FK `product_id` → `account_products`; FK `bank_id` → `banks`; FK `user_id` → `users`

### `entry_batches`
- Módulo: `Monetarie.Schemas.Accounts.EntryBatch` (`core/backend/lib/monetarie/schemas/accounts/entry_batch.ex:17`)
- Propósito: Agrupamento de lançamentos contábeis em lotes, com contagem, totais de débito/crédito e fluxo de aprovação e processamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `description` :string; `entry_count` :integer (default: 0); `total_debits` :integer (default: 0); `total_credits` :integer (default: 0); `status` :string (default: "draft"); `submitted_by` :binary_id; `approved_by` :binary_id; `processed_at` :utc_datetime; `metadata` :map (default: %{})
- Índices/chaves: index [status]

### `escrow_agreements`
- Módulo: `Monetarie.Schemas.Escrow.Agreement` (`core/backend/lib/monetarie/schemas/escrow/agreement.ex:18`)
- Propósito: Contratos de escrow, o negócio jurídico principal ao qual toda conta escrow é acessória, com finalidade e valor total.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference` :string; `purpose` :string; `purpose_doc_ref` :string; `modeling` Ecto.Enum (default: :e_money); `status` Ecto.Enum (default: :draft); `account_id` :id; `linked_loan_id` :binary_id; `provider` :string; `total_amount` :integer (default: 0); `currency` :string (default: "BRL"); `opened_at` :utc_datetime; `expires_at` :utc_datetime; `closed_at` :utc_datetime; `metadata` :map (default: %{})
- Índices/chaves: unique [:reference]; index [:status]; index [:account_id]

### `escrow_conditions`
- Módulo: `Monetarie.Schemas.Escrow.Condition` (`core/backend/lib/monetarie/schemas/escrow/condition.ex:15`)
- Propósito: Condição objetivamente verificável de um contrato de escrow, cuja liberação de fundos só avança quando todas as condições são satisfeitas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `agreement_id` :binary_id; `description` :string; `kind` Ecto.Enum; `status` Ecto.Enum (default: :pending); `verified_by` :string; `verified_at` :utc_datetime; `evidence_ref` :string; `ordering` :integer (default: 0)
- Índices/chaves: index [:agreement_id]

### `escrow_parties`
- Módulo: `Monetarie.Schemas.Escrow.Party` (`core/backend/lib/monetarie/schemas/escrow/party.ex:16`)
- Propósito: Partes de um contrato de conta escrow (depositante, beneficiário ou agente), com dados de KYC e indicação de PEP.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `agreement_id` :binary_id; `role` Ecto.Enum; `user_id` :integer; `name` :string; `document` :string; `email` :string; `phone` :string; `kyc_status` Ecto.Enum (default: :pending); `kyc_ref` :string; `is_pep` :boolean (default: false); `metadata` :map (default: %{})
- Índices/chaves: index [:agreement_id]; index [:agreement_id, :role]

### `escrow_releases`
- Módulo: `Monetarie.Schemas.Escrow.Release` (`core/backend/lib/monetarie/schemas/escrow/release.ex:19`)
- Propósito: Liberações de recursos de uma conta escrow ao beneficiário ou de volta ao depositante, vinculadas a condições e lançamento COSIF.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `agreement_id` :binary_id; `direction` Ecto.Enum; `amount` :integer; `status` Ecto.Enum (default: :requested); `condition_ids` {:array, :binary_id} (default: []); `requested_by` :string; `approved_by` :string; `tb_transfer_id` :string; `cosif_entry_id` :binary_id; `executed_at` :utc_datetime; `metadata` :map (default: %{})
- Índices/chaves: index [:agreement_id]; index [:status]; unique [:tb_transfer_id]

### `global_limits`
- Módulo: `Monetarie.Schemas.Limits.GlobalLimit` (`core/backend/lib/monetarie/schemas/limits/global_limit.ex:35`)
- Propósito: Limites globais de PIX-IN, PIX-OUT e TED por entidade, usados na resolução dos limites efetivos por cliente.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps
- Colunas: `limit_type` Ecto.Enum; `amount` :integer; `is_active` :boolean (default: true); `entity_id` Ecto.UUID
- Índices/chaves: unique [:entity_id, :limit_type]; index [:entity_id]; index [:limit_type]

### `overdraft_charges`
- Módulo: `Monetarie.Schemas.Accounts.OverdraftCharge` (`core/backend/lib/monetarie/schemas/accounts/overdraft_charge.ex:18`)
- Propósito: Cobranças diárias de juros e IOF sobre o uso do limite de cheque especial, agrupadas por período de faturamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `charge_date` :date; `usage_amount` :integer; `interest_amount` :integer; `iof_amount` :integer; `billing_period` :string; `billed` :boolean (default: false); `billed_at` :utc_datetime; `facility_id` belongs_to `Monetarie.Schemas.Accounts.OverdraftFacility`
- Índices/chaves: index [billing_period]; unique [facility_id, charge_date]; FK `facility_id` → `overdraft_facilities`

### `overdraft_facilities`
- Módulo: `Monetarie.Schemas.Accounts.OverdraftFacility` (`core/backend/lib/monetarie/schemas/accounts/overdraft_facility.ex:21`)
- Propósito: Controla os limites de cheque especial por conta, com taxa de juros anual, IOF e uso corrente.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `member_id` :binary_id; `approved_limit` :integer; `current_limit` :integer; `annual_rate_bps` :integer; `iof_rate_bps` :integer (default: 82); `iof_additional_bps` :integer (default: 38); `current_usage` :integer (default: 0); `peak_usage` :integer (default: 0); `last_usage_date` :date; `status` :string (default: "active"); `activated_at` :utc_datetime; `review_date` :date; `cancelled_at` :utc_datetime; `cancellation_reason` :string; `approved_by` :binary_id; `approved_at` :utc_datetime; `loan_product_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: unique [account_id]; index [member_id]; index [status]; FK `account_id` → `accounts`; FK `member_id` → `cooperative_members`

### `transfer_favorites`
- Módulo: `Monetarie.Schemas.TransferFavorites.TransferFavorite` (`core/backend/lib/monetarie/schemas/transfer_favorites/transfer_favorite.ex:9`)
- Propósito: Favoritos de transferência/PIX cadastrados por um lojista, com dados bancários ou chave PIX do destinatário.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `merchant_id` :integer; `name` :string; `document` :string; `bank_code` :string; `branch` :string; `account_number` :string; `account_type` :string (default: "checking"); `pix_key` :string; `pix_key_type` :string
- Índices/chaves: index [merchant_id]; unique [merchant_id, pix_key) WHERE (pix_key IS NOT NULL]; unique [merchant_id, document, bank_code, branch, account_number]; FK `merchant_id` → `users`

## 2. Clientes, entidades e onboarding

### `business_onboardings`
- Módulo: `Monetarie.Schemas.Onboarding.BusinessOnboarding` (`core/backend/lib/monetarie/schemas/onboarding/business_onboarding.ex:8`)
- Propósito: Processo de abertura de conta pessoa jurídica, controlando etapas concluídas e pendentes, CNPJ, razão social e responsável.
- Chave/particionamento: PK `id` binary_id (padrão); timestamps (type: :utc_datetime)
- Colunas: `user_id` :integer; `entity_id` :binary_id; `status` :string (default: "draft"); `current_step` :string (default: "email"); `completed_steps` {:array, :string} (default: []); `missing_steps` {:array, :string} (default: []); `cnpj` :string; `cpf_responsavel` :string; `razao_social` :string; `nome_fantasia` :string; `email` :string; `phone` :string; `data_abertura` :date; `natureza_juridica` :string; `cnae_principal` :string; `porte` :string; `capital_social` :decimal; `cep` :string; `street` :string; `number` :string; `complement` :string; `neighborhood` :string; `city` :string; `state` :string; `kyc_provider` :string; `kyc_execution_id` :string; `kyc_status` :string (default: "pending"); `kyb_status` :string (default: "pending"); `reviewed_by` :string; `reviewed_at` :utc_datetime; `rejection_reason` :string
- Índices/chaves: index [cnpj]; index [status]; index [user_id]; FK `entity_id` → `entities`; FK `user_id` → `users`

### `company_documents`
- Módulo: `Monetarie.Schemas.Onboarding.CompanyDocument` (`core/backend/lib/monetarie/schemas/onboarding/company_document.ex:7`)
- Propósito: Documentos societários enviados durante o onboarding de empresas, com tipo de documento, arquivo e status de aprovação ou rejeição.
- Chave/particionamento: PK `id` binary_id (padrão); timestamps (type: :utc_datetime)
- Colunas: `onboarding_id` :integer; `document_type` :string; `file_name` :string; `file_path` :string; `file_size` :integer; `content_type` :string; `status` :string (default: "pending"); `rejection_reason` :string
- Índices/chaves: index [onboarding_id]; FK `onboarding_id` → `business_onboardings`

### `entities`
- Módulo: `Monetarie.Schemas.Entities.Entity` (`core/backend/lib/monetarie/schemas/entities/entity.ex:8`)
- Propósito: Cadastro central de entidades participantes (instituições/ISPB) do sistema, com papel no PIX, liquidante e vínculo ao ledger contábil TigerBeetle.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `ispb` :string; `cnpj` :string; `entity_type` :string  # "SCD" | "IP" | "COOP" | "BANK" | "DTVM"; `pix_role` :string     # "direct" | "indirect"; `liquidante_ispb` :string; `ledger_id` :integer; `tb_cash_asset_account_id` :integer; `status` :string (default: "active"); `metadata` :map (default: %{}); `pix_provider` :string (default: "in_house"); `pix_provider_config` :map (default: %{})
- Índices/chaves: unique [cnpj]; index [entity_type]; unique [ispb]; unique [ledger_id]; index [status]

### `kyc_provider_configs`
- Módulo: `Monetarie.Schemas.Onboarding.Nextcode.KycProviderConfig` (`core/backend/lib/monetarie/schemas/onboarding/nextcode/kyc_provider_config.ex:17`)
- Propósito: Configuração de provedores externos de KYC (conheça seu cliente) usados na esteira de onboarding, com credenciais e ativação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `entity_id` Ecto.UUID; `provider` :string (default: "nextcode"); `credentials` :map (default: %{}); `settings` :map (default: %{}); `active` :boolean (default: true)
- Índices/chaves: unique [:entity_id, :provider]

### `nextcode_configs`
- Módulo: `Monetarie.Schemas.Onboarding.Nextcode.Config` (`core/backend/lib/monetarie/schemas/onboarding/nextcode/config.ex:17`)
- Propósito: Configurações de integração com o provedor NextCode para verificação biométrica no onboarding, com chave de API e webhook.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `entity_id` Ecto.UUID; `base_url` :string; `api_key` :string; `survey_id` :string; `active` :boolean (default: true); `webhook_url` :string; `webhook_secret` :string; `settings` :map; `payload_template` :map
- Índices/chaves: unique [:entity_id]

### `nextcode_proposals`
- Módulo: `Monetarie.Schemas.Onboarding.Nextcode.Proposal` (`core/backend/lib/monetarie/schemas/onboarding/nextcode/proposal.ex:18`)
- Propósito: Propostas de abertura de conta ou crédito processadas pelo parceiro NextCode, com status de análise e documento final gerado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `entity_id` Ecto.UUID; `external_id` :string; `cnpj` :string; `status` :string (default: "new"); `link` :string; `external_data` :map; `review_status` :string; `final_status` :string; `final_document` :binary
- Índices/chaves: unique [:external_id]; index [:cnpj]; index [:entity_id, :status]

### `onboarding_applications`
- Módulo: `Monetarie.Schemas.Onboarding.Application` (`core/backend/lib/monetarie/schemas/onboarding/application.ex:33`)
- Propósito: Solicitações de abertura de conta para pessoa física, com dados cadastrais, endereço e filiação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cpf` :string; `full_name` :string; `birth_date` :date; `gender` :string; `nationality` :string (default: "Brasileira"); `mother_name` :string; `cep` :string; `street` :string; `street_number` :string; `complement` :string; `neighborhood` :string; `city` :string; `state` :string; `occupation` :string; `company_name` :string; `income_range` :string; `is_pep` :boolean (default: false); `email` :string; `email_verified` :boolean (default: false); `phone` :string; `phone_verified` :boolean (default: false); `bureau_data` :map; `bureau_fetched_at` :utc_datetime_usec; `ocr_data` :map; `ocr_matches` :map; `ocr_classification` :map; `ocr_processed_at` :utc_datetime_usec; `face_match_confidence` :decimal; `face_matched` :boolean; `face_match_processed_at` :utc_datetime_usec; `liveness_matched` :boolean; `liveness_request_id` Ecto.UUID; `liveness_processed_at` :utc_datetime_usec; `document_front_path` :string; `document_back_path` :string; `selfie_path` :string; `cropped_face_path` :string; `status` :string (default: "draft"); `rejection_reason` :string; `reviewed_by` Ecto.UUID; `reviewed_at` :utc_datetime_usec; `doc_type` :string; `doc_number` :string; `doc_issuer` :string; `doc_issued_at` :date; `doc_expires_at` :date; `source_of_funds` :string; `account_purpose` :string; `data_constituicao` :date; `natureza_juridica` :string; `cnae_principal` :string; `capital_social` :decimal; `nextcode_request_ids` {:array, :map} (default: []); `ip_address` :string; `user_agent` :string; `metadata` :map (default: %{})
- Índices/chaves: index [cpf]; index [inserted_at]; index [status]

### `onboarding_events`
- Módulo: `Monetarie.Schemas.Onboarding.Event` (`core/backend/lib/monetarie/schemas/onboarding/event.ex:46`)
- Propósito: Eventos de auditoria da esteira de onboarding e abertura de conta, com tipo de evento, dados e ator responsável.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `event_type` :string; `event_data` :map (default: %{}); `actor_type` :string (default: "system"); `actor_id` Ecto.UUID; `inserted_at` :utc_datetime_usec; `application_id` belongs_to `Monetarie.Schemas.Onboarding.Application`
- Índices/chaves: index [application_id]; index [event_type]; FK `application_id` → `onboarding_applications`

### `onboarding_partners`
- Módulo: `Monetarie.Schemas.Onboarding.OnboardingPartner` (`core/backend/lib/monetarie/schemas/onboarding/onboarding_partner.ex:5`)
- Propósito: Sócios ou representantes vinculados a uma solicitação de abertura de conta pessoa jurídica, com participação societária e endereço.
- Chave/particionamento: PK `id` binary_id (padrão); timestamps (type: :utc_datetime)
- Colunas: `onboarding_id` :integer; `nome` :string; `cpf_cnpj` :string; `tipo` :string; `participacao` :decimal; `is_admin` :boolean (default: false); `is_legal_representative` :boolean (default: false); `cep` :string; `street` :string; `number` :string; `complement` :string; `neighborhood` :string; `city` :string; `state` :string; `kyc_status` :string (default: "pending"); `kyc_submission_id` :integer
- Índices/chaves: index [onboarding_id]; FK `onboarding_id` → `business_onboardings`

### `onboarding_registrations`
- Módulo: `Monetarie.Schemas.Onboarding.Nextcode.Registration` (`core/backend/lib/monetarie/schemas/onboarding/nextcode/registration.ex:16`)
- Propósito: Cadastros iniciais de onboarding de clientes pessoa jurídica, com e-mail, CNPJ, proposta vinculada e status do processo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `email` :string; `password_hash` :string; `cnpj` :string; `proposal_id` Ecto.UUID; `status` :string (default: "pending")
- Índices/chaves: unique [:email]; index [:proposal_id]; index [:status]

### `user_dashboard_preferences`
- Módulo: `Monetarie.Dashboard.Preferences` (`core/backend/lib/monetarie/dashboard/preferences.ex:24`)
- Propósito: Guarda as preferências de layout do painel administrativo de cada administrador, como ordem e visibilidade das seções.
- Chave/particionamento: PK `{:platform_admin_id, :binary_id, autogenerate: false}`; timestamps (type: :utc_datetime)
- Colunas: `hidden_sections` {:array, :string} (default: []); `section_order` {:array, :string} (default: []); `layout` {:array, :map} (default: [])

### `user_entities`
- Módulo: `Monetarie.Schemas.Entities.UserEntity` (`core/backend/lib/monetarie/schemas/entities/user_entity.ex:17`)
- Propósito: Vínculo entre usuários e entidades, pessoas jurídicas ou físicas, definindo papel, permissões e entidade padrão de acesso.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `user_id` :integer; `entity_id` :binary_id; `role` :string (default: "operator"); `is_default` :boolean (default: false); `permissions` :map (default: %{})
- Índices/chaves: index [entity_id]; unique [user_id) WHERE (is_default = true]; unique [user_id, entity_id]; index [user_id]

### `users`
- Módulo: `Monetarie.Schemas.Relational.User` (`core/backend/lib/monetarie/schemas/relational/user.ex:7`)
- Propósito: Usuários do sistema com credenciais, dados cadastrais, autenticação em dois fatores (TOTP/SMS) e controle de primeiro acesso.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`
- Colunas: `login` :string; `pass` :string (source: :password_hash); `tax_id` :string; `name` :string; `email` :string; `phone` :string; `totp_secret` :binary; `totp_enabled` :boolean (default: false); `sms_verified` :boolean (default: false); `mfa_backup_codes` {:array, :string} (default: []); `first_access_completed` :boolean (default: false); `must_change_password` :boolean (default: false); `email_verified` :boolean (default: false); `status` :string (default: "active"); `user_type` :string (default: "member_pf"); `ib_disabled` :boolean (default: false); `entity_id` Ecto.UUID; `partner_id` Ecto.UUID
- Índices/chaves: index [:partner_id]; FK `entity_id` → `entities`

## 3. Transações e pagamentos (PIX, TED/SPB, boleto, cheque, DDA)

### `approval_rules`
- Módulo: `Monetarie.Schemas.Payables.ApprovalRule` (`core/backend/lib/monetarie/schemas/payables/approval_rule.ex:33`)
- Propósito: Regras configuráveis de alçada de aprovação para pagamentos, definindo faixas de valor, papel exigido e número de aprovações.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `min_amount` :integer; `max_amount` :integer; `required_approvals` :integer (default: 1); `role` :string; `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: index [role]

### `check_leaves`
- Módulo: `Monetarie.Schemas.Checks.CheckLeaf` (`core/backend/lib/monetarie/schemas/checks/check_leaf.ex:22`)
- Propósito: Controla folhas individuais de cheques emitidos, com número, valor, favorecido e datas de emissão, apresentação e compensação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `check_number` :integer; `status` :string (default: "available"); `amount` :integer; `payee_name` :string; `issued_date` :date; `presented_date` :date; `cleared_date` :date; `notes` :string; `metadata` :map (default: %{}); `checkbook_id` belongs_to `Checkbook`
- Índices/chaves: unique [checkbook_id, check_number]; index [checkbook_id]; index [status]; FK `checkbook_id` → `checkbooks`

### `check_returns`
- Módulo: `Monetarie.Schemas.Checks.CheckReturn` (`core/backend/lib/monetarie/schemas/checks/check_return.ex:20`)
- Propósito: Registra devoluções de cheques, com motivo, valor, referência de compensação COMPE e atualização no SCR.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `return_date` :date; `reason_code` :string; `reason_description` :string; `amount` :integer; `return_count` :integer (default: 1); `compe_reference` :string; `member_notified` :boolean (default: false); `notified_at` :utc_datetime; `scr_updated` :boolean (default: false); `notes` :string; `metadata` :map (default: %{}); `check_leaf_id` belongs_to `CheckLeaf`
- Índices/chaves: index [account_id]; index [check_leaf_id]; index [reason_code]; index [return_date]; FK `account_id` → `accounts`; FK `check_leaf_id` → `check_leaves`

### `check_stops`
- Módulo: `Monetarie.Schemas.Checks.CheckStop` (`core/backend/lib/monetarie/schemas/checks/check_stop.ex:22`)
- Propósito: Pedidos de sustação de cheques, com motivo, número de boletim de ocorrência, aprovação e prazo de validade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `requested_date` :date; `reason` :string; `police_report_number` :string; `status` :string (default: "requested"); `approved_by` :binary_id; `approved_at` :utc_datetime; `expires_at` :date; `requested_by` :binary_id; `requested_by_name` :string; `notes` :string; `metadata` :map (default: %{}); `check_leaf_id` belongs_to `CheckLeaf`
- Índices/chaves: index [account_id]; index [check_leaf_id]; index [status]; FK `account_id` → `accounts`; FK `check_leaf_id` → `check_leaves`

### `checkbooks`
- Módulo: `Monetarie.Schemas.Checks.Checkbook` (`core/backend/lib/monetarie/schemas/checks/checkbook.ex:23`)
- Propósito: Talões de cheques emitidos para contas correntes, com série, faixa de numeração, status de aprovação e emissão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `member_id` :binary_id; `branch_id` :binary_id; `series` :string; `start_number` :integer; `end_number` :integer; `leaf_count` :integer; `status` :string (default: "requested"); `requested_at` :utc_datetime; `approved_at` :utc_datetime; `approved_by` :binary_id; `issued_at` :utc_datetime; `cancelled_at` :utc_datetime; `cancellation_reason` :string; `metadata` :map (default: %{})
- Índices/chaves: index [account_id]; unique [account_id, series]; index [branch_id]; index [member_id]; index [status]; FK `branch_id` → `branches`; FK `member_id` → `cooperative_members`

### `cnab_retorno_records`
- Módulo: `Monetarie.Schemas.Receivables.Cnab.RetornoRecord` (`core/backend/lib/monetarie/schemas/receivables/cnab/retorno_record.ex:17`)
- Propósito: Registros de arquivos de retorno CNAB de cobrança bancária, com nosso número, código de movimento e valores pagos, juros e multa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `idempotency_key` :string; `nosso_numero` :string; `codigo_movimento` :string; `movimento` :string; `banco_code` :string; `lote` :integer; `sequencial` :integer; `nsa` :integer; `valor_titulo` :integer; `valor_pago` :integer; `valor_juros` :integer (default: 0); `valor_multa` :integer (default: 0); `valor_desconto` :integer (default: 0); `data_ocorrencia` :date; `data_credito` :date; `codigo_rejeicao` :string; `status` :string (default: "processado"); `metadata` :map (default: %{})
- Índices/chaves: index [banco_code, nsa]; unique [idempotency_key]; index [nosso_numero]

### `cnab_sequences` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Sequências numéricas de remessa e registro CNAB controladas pelo SequenceManager (use_cases/receivables/cnab/sequence_manager.ex).
- Colunas: `id` uuid NOT NULL; `banco_code` character varying(255) NOT NULL; `tipo_arquivo` character varying(255) DEFAULT 'remessa'::character varying NOT NULL; `proximo_nsa` integer DEFAULT 1 NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: unique [banco_code, tipo_arquivo]

### `compe_checks`
- Módulo: `Monetarie.Schemas.Compe.Check` (`core/backend/lib/monetarie/schemas/compe/check.ex:26`)
- Propósito: Cheques compensados pelo sistema COMPE, com código CMC7, banco, agência, motivo e código de devolução.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `check_number` :string; `bank_code` :string; `branch_code` :string; `account_number` :string; `amount` :integer; `issue_date` :date; `clearing_date` :date; `status` :string (default: "REGISTERED"); `cmc7_code` :string; `rejection_reason` :string; `rejection_code` :string; `return_date` :date; `presenting_bank_code` :string; `presenting_branch_code` :string; `batch_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [bank_code]; index [bank_code, status]; index [batch_id]; unique [check_number]; index [clearing_date]; unique [cmc7_code]; index [issue_date]; index [status]; FK `batch_id` → `compe_clearing_batches`

### `compe_clearing_batches`
- Módulo: `Monetarie.Schemas.Compe.ClearingBatch` (`core/backend/lib/monetarie/schemas/compe/clearing_batch.ex:22`)
- Propósito: Lotes de compensação de cheques via COMPE, com quantidade de cheques, valores totais e tipo de liquidação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `batch_number` :string; `clearing_date` :date; `total_checks` :integer (default: 0); `total_amount` :integer (default: 0); `net_amount` :integer (default: 0); `status` :string (default: "OPEN"); `settled_at` :utc_datetime_usec; `settlement_type` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [batch_number]; index [clearing_date]; index [status]

### `dda_authorizations`
- Módulo: `Monetarie.Schemas.DDA.Authorization` (`core/backend/lib/monetarie/schemas/dda/authorization.ex:31`)
- Propósito: Autorizações de Débito Direto Autorizado (DDA) do sacado, com valor autorizado, tipo, vigência e status da autorização.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `sacado_document` :string; `sacado_account_id` :binary_id; `authorization_type` :string; `authorized_amount` :integer; `status` :string (default: "PENDING"); `authorized_at` :utc_datetime_usec; `revoked_at` :utc_datetime_usec; `valid_until` :date; `metadata` :map (default: %{}); `titulo_id` belongs_to `Monetarie.Schemas.DDA.Titulo`
- Índices/chaves: index [authorization_type]; index [sacado_document]; index [status]; index [titulo_id]; index [valid_until]; FK `titulo_id` → `dda_titulos`

### `dda_convenios`
- Módulo: `Monetarie.Schemas.DDA.Convenio` (`core/backend/lib/monetarie/schemas/dda/convenio.ex:31`)
- Propósito: Convênios do DDA (Débito Direto Autorizado/Domicílio Bancário de Boletos) com cedentes, produto, tarifa e vigência do acordo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `convenio_number` :string; `cedente_ispb` :string; `cedente_cnpj` :string; `cedente_name` :string; `product_type` :string; `status` :string (default: "ACTIVE"); `start_date` :date; `end_date` :date; `tariff_type` :string; `metadata` :map (default: %{})
- Índices/chaves: index [cedente_cnpj]; index [cedente_ispb]; unique [convenio_number]; index [product_type]; index [status]

### `dda_titulos`
- Módulo: `Monetarie.Schemas.DDA.Titulo` (`core/backend/lib/monetarie/schemas/dda/titulo.ex:31`)
- Propósito: Títulos recebidos via DDA, débito direto autorizado, com linha digitável, sacado, cedente e valores de desconto, juros e multa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `titulo_number` :string; `barcode` :string; `digitable_line` :string; `sacado_document` :string; `sacado_name` :string; `cedente_document` :string; `amount` :integer; `discount_amount` :integer (default: 0); `interest_amount` :integer (default: 0); `fine_amount` :integer (default: 0); `due_date` :date; `issue_date` :date; `status` :string (default: "REGISTERED"); `payment_date` :date; `paid_amount` :integer; `spb_message_id` :string; `metadata` :map (default: %{}); `convenio_id` belongs_to `Monetarie.Schemas.DDA.Convenio`
- Índices/chaves: unique [barcode]; index [cedente_document]; index [convenio_id]; index [digitable_line]; index [due_date]; index [sacado_document]; index [spb_message_id]; index [status]; FK `convenio_id` → `dda_convenios`

### `dict_lookup_events`
- Módulo: `Monetarie.Schemas.Pix.DictLookupEvent` (`core/backend/lib/monetarie/schemas/pix/dict_lookup_event.ex:5`)
- Propósito: Eventos de consulta ao DICT (chaves PIX), com tipo de chave, custo em tokens, resultado da busca e data da ocorrência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `entity_id` Ecto.UUID; `end_to_end_id` :string; `result_type` :string; `token_cost` :integer (default: 0); `token_delta` :integer (default: 0); `account_id` :integer; `requestor_kind` :string; `key_type` :string; `occurred_at` :utc_datetime_usec; `bucket_credited_at` :utc_datetime_usec

### `dict_monitoring_alerts`
- Módulo: `Monetarie.Schemas.Pix.DictMonitoringAlert` (`core/backend/lib/monetarie/schemas/pix/dict_monitoring_alert.ex:17`)
- Propósito: Alertas de monitoramento do DICT (Diretório de Identificadores de Contas Transacionais do PIX), com métrica, limiar excedido e severidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `account_id` :integer; `window` :string; `kind` :string; `severity` :string; `metric_value` :float; `threshold` :float; `total` :integer (default: 0); `status` :string (default: "open"); `detail` :map (default: %{}); `reviewed_by` :string; `reviewed_at` :utc_datetime_usec

### `dict_monitoring_snapshots`
- Módulo: `Monetarie.Schemas.Pix.DictMonitoringSnapshot` (`core/backend/lib/monetarie/schemas/pix/dict_monitoring_snapshot.ex:8`)
- Propósito: Snapshots de monitoramento do DICT do PIX, com taxa de não encontrados, VCD e indicadores de encerramento por janela.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `account_id` :integer; `window` :string; `total` :integer (default: 0); `success` :integer (default: 0); `not_found` :integer (default: 0); `considered` :integer (default: 0); `pct_notfound` :float (default: 0.0); `vcd` :integer (default: 0); `eos_terminal` :integer (default: 0); `eos_settled` :integer (default: 0); `vcd_eos_terminal` :float; `vcd_eos_settled` :float; `computed_at` :utc_datetime_usec

### `failed_transactions` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260316100001_create_outbound_requests.exs`
- Propósito: Registro de transações PIX que falharam no fluxo v2, usado para diagnóstico e reprocessamento (controllers/v2/pix_controller.ex).
- Colunas: `id` :binary; `tb_settlement_id` :binary; `transaction_id` :string; `end_to_end_id` :string; `account_id` :integer; `amount` :integer; `fee_amount` :integer; `type` :string; `direction` :string; `tb_error_code` :string; `failure_stage` :integer; `failure_reason` :string; `recipient_key` :string; `recipient_name` :string; `merchant_id` :string; `entity_id` :uuid; `metadata` :map; `client_request_id` :binary; `started_at` :utc_datetime; `failed_at` :utc_datetime

### `inflow_requests` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Tabela legada do baseline com pedidos de entrada de recursos do sistema anterior, sem uso no código atual.
- Colunas: `id` bigint DEFAULT nextval('public.inflow_requests_id_seq'::regclass) NOT NULL; `user_id` integer NOT NULL; `kind` smallint NOT NULL; `amount` bigint NOT NULL; `status` smallint DEFAULT 0 NOT NULL; `started_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `finished_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `id` bigint DEFAULT nextval('public.inflow_requests_id_seq'::regclass) NOT NULL; `user_id` integer NOT NULL; `kind` smallint NOT NULL; `amount` bigint NOT NULL; `status` smallint DEFAULT 0 NOT NULL; `started_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `finished_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
- Índices/chaves: FK `user_id` → `users`

### `infraction_configurations`
- Módulo: `Monetarie.Schemas.Med.InfractionConfiguration` (`core/backend/lib/monetarie/schemas/med/infraction_configuration.ex:17`)
- Propósito: Configuração de processamento automático de infrações MED por lojista, com limiar mínimo, motivo de rejeição e prazo de análise.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `merchant_id` :integer; `min_threshold_amount` :integer; `auto_reject_reason` :string; `analysis_deadline_hours` :integer (default: 72); `notify_client` :boolean (default: true); `notify_compliance` :boolean (default: true); `enabled` :boolean (default: true); `cautelar_block_enabled` :boolean (default: true)
- Índices/chaves: unique [:merchant_id]

### `med_cautelar_blocks`
- Módulo: `Monetarie.Schemas.Med.MedCautelarBlock` (`core/backend/lib/monetarie/schemas/med/med_cautelar_block.ex:34`)
- Propósito: Bloqueios cautelares de fundos por infração MED (Mecanismo Especial de Devolução) do PIX, com valor bloqueado, análise e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `account_id` :integer; `merchant_id` :integer; `recovery_id` :string; `e2e_id` :string; `blocked_amount` :integer; `tb_transfer_id` :string; `pool_id` :integer; `infraction_report_id` :string; `status` :string (default: "active"); `analysis_status` :string (default: "pending"); `analysis_notes` :string; `analyst_id` :string; `released_at` :utc_datetime_usec; `release_reason` :string; `evidence_metadata` :map (default: %{}); `deadline` :utc_datetime_usec; `fraud_category` :string; `hold_transfer_id` :string; `fee_transfer_id` :string; `requested_amount` :integer; `fee_amount` :integer (default: 0); `balance_snapshot` :integer; `hold_status` :string; `return_stage` :integer; `pix_key` :string; `pix_key_type` :string
- Índices/chaves: index [account_id]; index [analysis_status]; index [e2e_id]; index [merchant_id]; index [recovery_id]; index [status]

### `med_configurations`
- Módulo: `Monetarie.Schemas.Med.MedConfiguration` (`core/backend/lib/monetarie/schemas/med/med_configuration.ex:15`)
- Propósito: Configuração do MED (Mecanismo Especial de Devolução) por lojista, com limiar de valor, bloqueio cautelar e prazo de análise.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `merchant_id` :integer; `min_threshold_amount` :integer; `auto_reject_reason` :string (default: "Suspeita infundada de fraude"); `analysis_deadline_hours` :integer (default: 72); `notify_client` :boolean (default: true); `notify_compliance` :boolean (default: true); `enabled` :boolean (default: true); `cautelar_block_enabled` :boolean (default: true)
- Índices/chaves: unique [merchant_id]

### `message_timeline` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260427180000_create_message_timeline.exs`
- Propósito: Acervo particionado por mês de mensagens e eventos comprimidos por correlação, gravado pelo Monetarie.Infra.MessageArchive.
- Particionamento: particionada por RANGE mensal (migration `20260704133000`)
- Colunas: `message_id` VARCHAR(255) NOT NULL; `source` VARCHAR(255) NOT NULL; `direction` VARCHAR(8)   NOT NULL CHECK (direction IN ('inbound', 'outbound')); `message_type` VARCHAR(64); `key` VARCHAR(64); `sec_key` VARCHAR(64); `pod_id` VARCHAR(64)  NOT NULL; `payload` BYTEA; `received_at` TIMESTAMPTZ  NOT NULL

### `outbound_requests`
- Módulo: `Monetarie.Schemas.Relational.OutboundRequest` (`core/backend/lib/monetarie/schemas/relational/outbound_request.ex:43`)
- Propósito: Fila mutável de pagamentos de saída em andamento (PIX/TED), com idempotência, conta de destino, valor e tarifa.
- Chave/particionamento: PK `{:id, :binary, autogenerate: false}`
- Colunas: `transaction_id` :string; `end_to_end_id` :string; `idempotency_key` :string; `client_request_id` :binary; `account_id` :integer; `to_account_id` :integer (default: AccountCode.settlement_pool(); `entity_id` Ecto.UUID; `merchant_id` :string; `type` :string (default: "pix"); `amount` :integer; `fee_amount` :integer (default: 0); `description` :string; `recipient_key` :string; `recipient_key_type` :string; `recipient_name` :string; `recipient_document` :string; `recipient_ispb` :string; `pending_fee_id` :binary; `pending_settlement_id` :binary; `stage` :integer (default: 0); `error_reason` :string; `metadata` :map (default: %{}); `api_response` :map; `started_at` :utc_datetime; `updated_at` :utc_datetime
- Índices/chaves: unique [:idempotency_key]; unique [:end_to_end_id]; index [:transaction_id]; index [:account_id]; index [:client_request_id]; index [:stage, :updated_at]

### `outflow_requests` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Tabela legada do baseline com pedidos de saída de recursos do sistema anterior, sem uso no código atual.
- Colunas: `id` bigint DEFAULT nextval('public.outflow_requests_id_seq'::regclass) NOT NULL; `user_id` integer NOT NULL; `account_id` bigint NOT NULL; `kind` smallint NOT NULL; `amount` bigint NOT NULL; `status` smallint DEFAULT 0 NOT NULL; `started_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `finished_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `id` bigint DEFAULT nextval('public.outflow_requests_id_seq'::regclass) NOT NULL; `user_id` integer NOT NULL; `account_id` bigint NOT NULL; `kind` smallint NOT NULL; `amount` bigint NOT NULL; `status` smallint DEFAULT 0 NOT NULL; `started_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL; `finished_at` timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
- Índices/chaves: FK `user_id` → `users`

### `payables`
- Módulo: `Monetarie.Schemas.Payables.Payable` (`core/backend/lib/monetarie/schemas/payables/payable.ex:46`)
- Propósito: Contas a pagar da instituição, com fornecedor, valor, vencimento, forma de pagamento e dados bancários ou chave PIX de destino.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `supplier_name` :string; `supplier_document` :string; `description` :string; `amount` :integer; `due_date` :date; `payment_date` :date; `status` :string (default: "pending"); `payment_method` :string; `bank_code` :string; `agency` :string; `account_number` :string; `pix_key` :string; `barcode` :string; `batch_id` :binary_id; `approval_level` :integer (default: 0); `approved_by` :string; `approved_at` :utc_datetime; `rejected_reason` :string; `recurrence_type` :string; `recurrence_end_date` :date; `nats_message_id` :string; `metadata` :map (default: %{})
- Índices/chaves: index [batch_id]; index [due_date]; index [status]; index [supplier_document]; FK `batch_id` → `payment_batches`

### `payment_batches`
- Módulo: `Monetarie.Schemas.Payables.PaymentBatch` (`core/backend/lib/monetarie/schemas/payables/payment_batch.ex:31`)
- Propósito: Lotes de pagamentos a fornecedores ou folha processados em conjunto, com valor total, itens processados, falhos e responsável pelo envio.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `status` :string (default: "draft"); `total_amount` :integer (default: 0); `item_count` :integer (default: 0); `processed_count` :integer (default: 0); `failed_count` :integer (default: 0); `submitted_at` :utc_datetime; `completed_at` :utc_datetime; `submitted_by` :string; `metadata` :map (default: %{})
- Índices/chaves: index [status]

### `pending_transactions`
- Módulo: `Monetarie.Schemas.Relational.PendingTransaction` (`core/backend/lib/monetarie/schemas/relational/pending_transaction.ex:30`)
- Propósito: Espelho em Postgres das transferências pendentes no TigerBeetle, usado para rastrear tentativas, reprocessamento e status de conclusão.
- Chave/particionamento: PK `{:id, :binary, autogenerate: false}`
- Colunas: `from_account_id` :integer; `to_account_id` :integer; `requestor_id` :integer; `amount` :integer; `kind` :integer; `status` :integer (default: 0); `retry_count` :integer (default: 0); `started_at` :utc_datetime_usec; `last_retry` :utc_datetime_usec
- Índices/chaves: index [from_account_id]; index [started_at]; index [status]; index [to_account_id]

### `pix_account_daily_rollups` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260709170000_create_account_daily_rollups.exs`
- Propósito: Rollups diários de movimentação PIX por conta para analytics, mantidos por Monetarie.UseCases.Analytics.AccountDailyRollups (flag ACCOUNT_ROLLUPS_ENABLED).
- Colunas: `account_id` :bigint; `day` :date; `entity_id` :uuid; `count_inbound` :bigint; `count_outbound` :bigint; `volume_inbound_subcent` :bigint; `volume_outbound_subcent` :bigint; `fee_total_subcent` :bigint; `computed_at` :utc_datetime_usec

### `pix_idempotency_log`
- Módulo: `Monetarie.Schemas.Pix.IdempotencyLog` (`core/backend/lib/monetarie/schemas/pix/idempotency_log.ex:57`)
- Propósito: Log de auditoria somente-escrita das checagens de idempotência de PIX, com chave, End-to-End ID e detecção de duplicidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `idempotency_key` :string; `e2e_id` :string; `account_id` :integer; `amount` :integer; `direction` :string; `status` :string; `duplicate_detected` :boolean (default: false)
- Índices/chaves: index [:idempotency_key]; index [:e2e_id]; index [:account_id, :inserted_at]

### `pix_in_credit_wal`
- Módulo: `Monetarie.Schemas.Pix.PixInCreditWal` (`core/backend/lib/monetarie/schemas/pix/pix_in_credit_wal.ex:36`)
- Propósito: Log de escrita antecipada do estado de crédito de PIX recebido no Core, garantindo consistência entre TigerBeetle e Postgres.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `e2e_id` :string; `account_id` :integer; `amount_subcent` :integer; `payload` :map (default: %{}); `state` :string (default: "received"); `attempts` :integer (default: 0); `last_error` :string; `received_at` :utc_datetime; `tb_done_at` :utc_datetime; `pg_done_at` :utc_datetime; `completed_at` :utc_datetime; `cosif_deferred` :boolean (default: false); `cosif_projected_at` :utc_datetime
- Índices/chaves: unique [:e2e_id]; index [:state, :updated_at]; index [:received_at]

### `pix_keys` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260624124000_create_core_pix_keys.exs`
- Propósito: Espelho local de chaves PIX por conta usado pelo AccountResolver para resolver a conta creditora no PIX-in.
- Colunas: `account_id` references(:accounts; `user_id` references(:users; `key_type` :string; `key_value` :text; `owner_cpf_cnpj` :string; `owner_name` :string; `owner_type` :string; `ispb` :string; `branch_code` :string; `account_number` :string; `status` :string; `cid` :string; `source` :string; `matched` :boolean; `last_seen_at` :utc_datetime_usec; `expires_at` :utc_datetime_usec; `inserted_at` :utc_datetime_usec; `updated_at` :utc_datetime_usec

### `pix_out_lifecycle_events`
- Módulo: `Monetarie.Schemas.Payments.PixOutLifecycleEvent` (`core/backend/lib/monetarie/schemas/payments/pix_out_lifecycle_event.ex:14`)
- Propósito: Log operacional somente-inclusão das transições de estágio do ciclo de vida de um PIX enviado, com motivo da mudança.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec, updated_at: false)
- Colunas: `outbound_request_id` :binary; `transaction_id` :string; `account_id` :integer; `merchant_id` :string; `entity_id` Ecto.UUID; `end_to_end_id` :string; `external_id` :string; `amount` :integer; `from_stage` :integer; `to_stage` :integer; `event` :string; `reason` :string; `occurred_at` :utc_datetime_usec; `metadata` :map (default: %{})

### `pix_recurrence_instructions`
- Módulo: `Monetarie.Schemas.PixAutomatico.Instruction` (`core/backend/lib/monetarie/schemas/pix_automatico/instruction.ex:19`)
- Propósito: Execução agendada individual dentro de uma recorrência de PIX Automático, com data, valor, status e tentativas de reprocessamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `scheduled_date` :date; `executed_at` :utc_datetime_usec; `amount` :decimal; `payment_id` :string; `transaction_id` :string; `end_to_end_id` :string; `status` :string (default: "scheduled"); `error_reason` :string; `retry_count` :integer (default: 0); `max_retries` :integer (default: 3); `next_retry_at` :utc_datetime_usec; `metadata` :map (default: %{}); `recurrence_id` belongs_to `Recurrence`
- Índices/chaves: index [payment_id]; index [recurrence_id]; index [scheduled_date]; index [status]; FK `recurrence_id` → `pix_recurrences`

### `pix_recurrences`
- Módulo: `Monetarie.Schemas.PixAutomatico.Recurrence` (`core/backend/lib/monetarie/schemas/pix_automatico/recurrence.ex:27`)
- Propósito: Mandatos de PIX Automático (recorrente), com dados do devedor e credor, ISPBs envolvidos e conta vinculada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `mandate_id` :string; `merchant_id` :integer; `participant_ispb` :string; `debtor_ispb` :string; `debtor_name` :string; `debtor_document` :string; `debtor_account` :string; `debtor_account_type` :string; `creditor_ispb` :string; `creditor_name` :string; `creditor_document` :string; `creditor_account` :string; `creditor_account_type` :string; `amount` :decimal; `currency` :string (default: "BRL"); `description` :string; `frequency` :string; `start_date` :date; `end_date` :date; `next_execution` :date; `day_of_month` :integer; `day_of_week` :integer; `status` :string (default: "pending"); `paused_at` :utc_datetime_usec; `cancelled_at` :utc_datetime_usec; `cancellation_reason` :string; `completed_at` :utc_datetime_usec; `bcb_end_to_end_id` :string; `bcb_protocol` :string; `pain_message_id` :string; `total_executions` :integer (default: 0); `successful_executions` :integer (default: 0); `failed_executions` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: index [creditor_document]; index [debtor_document]; unique [mandate_id]; index [merchant_id]; index [next_execution]; index [status]

### `protestos`
- Módulo: `Monetarie.Schemas.Npc.Protesto.Record` (`core/backend/lib/monetarie/schemas/npc/protesto/record.ex:32`)
- Propósito: Registros de protesto de boletos em cartório, com sacado, cedente, prazo de protesto e datas de instrução, efetivação e sustação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `boleto_id` :string; `nosso_numero` :string; `valor_titulo` :integer; `documento_sacado` :string; `nome_sacado` :string; `documento_cedente` :string; `nome_cedente` :string; `data_vencimento` :date; `prazo_protesto_dias` :integer (default: 3); `data_instrucao` :utc_datetime_usec; `data_efetivacao` :utc_datetime_usec; `data_sustacao` :utc_datetime_usec; `data_cancelamento` :utc_datetime_usec; `status` :string (default: "pendente"); `motivo_sustacao` :string; `motivo_cancelamento` :string; `cartorio_codigo` :string; `cartorio_protocolo` :string; `custas_cartorarias` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: index [boleto_id]; index [data_vencimento]; index [documento_sacado]; index [nosso_numero]; index [status]

### `qrcodes`
- Módulo: `Monetarie.Schemas.Pix.QRCode` (`core/backend/lib/monetarie/schemas/pix/qrcode.ex:42`)
- Propósito: QR Codes PIX estático ou dinâmico gerados para cobrança, com chave PIX, valor, txid e payload do BR Code.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `entity_id` Ecto.UUID; `account_id` :integer; `type` :string; `status` :string (default: "active"); `amount` :integer; `description` :string; `pix_key` :string; `pix_key_type` :string; `tx_id` :string; `payload` :string; `merchant_name` :string; `merchant_city` :string; `location_url` :string; `expires_at` :utc_datetime; `used_at` :utc_datetime; `payment_end_to_end_id` :string; `paid_at` :utc_datetime; `external_id` :string
- Índices/chaves: index [:entity_id]; index [:account_id]; unique [:tx_id]; index [:status, :expires_at]

### `scheduled_pix`
- Módulo: `Monetarie.Schemas.Pix.ScheduledPix` (`core/backend/lib/monetarie/schemas/pix/scheduled_pix.ex:22`)
- Propósito: PIX de saída agendado para execução futura, com chave, valor, data agendada, status de processamento e motivo de erro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `user_id` :integer; `account_id` :integer; `entity_id` :binary_id; `amount` :integer; `pix_key` :string; `description` :string; `request_params` :map (default: %{}); `scheduled_for` :date; `status` :string (default: "pending"); `transaction_id` :string; `end_to_end_id` :string; `error_reason` :string; `executed_at` :utc_datetime
- Índices/chaves: index [:scheduled_for, :status]; index [:user_id, :status]

### `settlement_ldl_batches`
- Módulo: `Monetarie.Schemas.Settlement.LdlBatch` (`core/backend/lib/monetarie/schemas/settlement/ldl_batch.ex:29`)
- Propósito: Lotes de liquidação diferida (LDL) por câmara de compensação, com valores bruto e líquido por janela de liquidação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `batch_number` :string; `clearing_code` :string; `settlement_date` :date; `total_orders` :integer (default: 0); `gross_amount` :integer (default: 0); `net_amount` :integer (default: 0); `status` :string (default: "OPEN"); `window` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [batch_number]; index [clearing_code, settlement_date]; index [status]; index ["window"]

### `settlement_orders`
- Módulo: `Monetarie.Schemas.Settlement.SettlementOrder` (`core/backend/lib/monetarie/schemas/settlement/settlement_order.ex:34`)
- Propósito: Ordens de liquidação do SPB (LDL diferida e transferência LTR), com participante, janela de liquidação e mensagem SPB associada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `order_type` :string; `clearing_code` :string; `participant_ispb` :string; `amount` :integer (default: 0); `settlement_date` :date; `window_id` :string; `status` :string (default: "PENDING"); `exception_reason` :string; `spb_message_id` :string; `batch_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [batch_id]; index [clearing_code, settlement_date]; index [order_type]; index [participant_ispb]; index [spb_message_id]; index [status]; index [window_id]; FK `batch_id` → `settlement_ldl_batches`

### `spb_cosif_mirror`
- Módulo: `Monetarie.Schemas.Spb.CosifMirror` (`core/backend/lib/monetarie/schemas/spb/cosif_mirror.ex:32`)
- Propósito: Espelho de conciliação do lançamento COSIF emitido pela cabine SPB, com conta de débito e crédito, evento e ISPB.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `operation_id` :string; `cd_evento` :string; `cd_msg` :string; `leg` :string (default: "full"); `debit_account` :string; `credit_account` :string; `amount` :decimal; `movement_date` :date; `source_ispb` :string; `inserted_at` :utc_datetime_usec
- Índices/chaves: unique [:operation_id, :cd_evento, :leg]; index [:movement_date]

### `spb_inbound_credits`
- Módulo: `Monetarie.Schemas.Spb.InboundCredit` (`core/backend/lib/monetarie/schemas/spb/inbound_credit.ex:51`)
- Propósito: Registro de créditos recebidos via SPB e repassados ao Core, com número de controle STR, valor e dados do creditado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `num_ctrl_str` :string; `operation_id` :string; `message_type` :string; `credit_kind` :string; `amount_cents` :integer; `dt_movto` :date; `debtor_ispb` :string; `creditor_account` :string; `creditor_agency` :string; `creditor_account_type` :string; `creditor_person_type` :string; `creditor_cpf_cnpj` :string; `creditor_name` :string; `debtor_account` :string; `debtor_agency` :string; `debtor_account_type` :string; `debtor_person_type` :string; `debtor_cpf_cnpj` :string; `debtor_name` :string; `status` :string (default: "processing"); `account_id` :integer; `treasury_account_id` :binary_id; `resolution` :map (default: %{})

### `transactions`
- Módulo: `Monetarie.Schemas.Relational.Transaction` (`core/backend/lib/monetarie/schemas/relational/transaction.ex:40`)
- Propósito: Tabela unificada de TODAS as transações (PIX, TED, boleto, interna), ciclo de vida e E2E; valor em subcentavos.
- Chave/particionamento: PK `{:id, :binary, autogenerate: false}`; particionada por RANGE mensal em `started_at`; PK composta `(id, started_at)`
- Colunas: `from_account_id` :integer; `to_account_id` :integer; `requestor_id` :integer; `amount` :integer; `kind` :integer; `status` :integer (default: 0); `started_at` :utc_datetime_usec; `finished_at` :utc_datetime_usec; `transaction_id` :string; `end_to_end_id` :string; `merchant_id` :string; `type` :string; `payment_status` :string; `direction` :string; `account_id` :integer; `entity_id` Ecto.UUID; `client_request_id` :binary; `tb_settlement_id` :binary; `hold_id` :string; `recipient_key` :string; `error_reason` :string; `fee_amount` :integer (default: 0); `net_amount` :integer; `refund_of_id` :binary; `description` :string; `counterparty_name` :string; `metadata` :map (default: %{}); `completed_at` :utc_datetime_usec

## 4. Tarifas e faturamento

### `bank_account_fees` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Registro legado de tarifas de conta consultado pelas rotinas de receita COSIF (use_cases/cosif/revenue_routines.ex).
- Colunas: `id` uuid NOT NULL; `bank_account_id` uuid NOT NULL; `fee_type` character varying(255) NOT NULL; `amount` integer DEFAULT 0 NOT NULL; `percentage` numeric(8,4); `min_amount` integer; `max_amount` integer; `description` character varying(255); `active` boolean DEFAULT true; `inserted_at` timestamp(0) without time zone NOT NULL; `updated_at` timestamp(0) without time zone NOT NULL
- Índices/chaves: index [bank_account_id]; unique [bank_account_id, fee_type]

### `billing_events`
- Módulo: `Monetarie.Schemas.Billing.BillingEvent` (`core/backend/lib/monetarie/schemas/billing/billing_event.ex:43`)
- Propósito: Registra eventos faturáveis individuais de Banking as a Service, com tenant, tipo de evento, valor e fatura associada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tenant_id` :binary_id; `event_type` :string; `event_id` :string; `amount` :integer; `billable_amount` :integer; `description` :string; `invoice_id` :binary_id; `occurred_at` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [event_type]; index [tenant_id, invoice_id]; index [tenant_id, occurred_at]; FK `tenant_id` → `tenants`

### `billing_plans`
- Módulo: `Monetarie.Schemas.Billing.BillingPlan` (`core/backend/lib/monetarie/schemas/billing/billing_plan.ex:45`)
- Propósito: Planos de cobrança oferecidos a clientes BaaS, com tarifa mensal base, regras de precificação e descontos por volume.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `code` :string; `description` :string; `status` :string (default: "active"); `monthly_base_fee` :integer (default: 0); `pricing_rules` :map (default: %{}); `volume_discounts` :map (default: %{}); `metadata` :map (default: %{})
- Índices/chaves: unique [code]; index [status]

### `fee_categories`
- Módulo: `Monetarie.Schemas.Fees.FeeCategory` (`core/backend/lib/monetarie/schemas/fees/fee_category.ex:8`)
- Propósito: Categorias de tarifas bancárias cadastradas por instituição, usadas para organizar o catálogo de tarifas cobradas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `name` :string; `slug` :string; `sort_order` :integer (default: 0); `is_active` :boolean (default: true); `is_system` :boolean (default: false)
- Índices/chaves: unique [:institution_id, :slug]; index [:institution_id, :is_active]

### `fee_configs`
- Módulo: `Monetarie.Schemas.Fees.FeeConfig` (`core/backend/lib/monetarie/schemas/fees/fee_config.ex:46`)
- Propósito: Regras de precificação de tarifas por tipo de serviço, cliente e faixa de valor, incluindo cobrança fixa, percentual e franquia mensal.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `fee_type` :string; `client_type` :string (default: "all"); `sub_type` :string; `fee_amount_fixed` :integer (default: 0); `fee_amount_percent` :decimal (default: Decimal.new("0"); `fee_min` :integer (default: 0); `fee_max` :integer; `amount_from` :integer (default: 0); `amount_to` :integer; `free_transactions_per_month` :integer (default: 0); `applies_to_members` :boolean (default: true); `applies_to_non_members` :boolean (default: true); `member_status` :string (default: "all"); `charging_model` :string (default: "monthly"); `cosif_credit_account` :string; `description` :string; `is_active` :boolean (default: true); `effective_from` :date; `effective_until` :date; `created_by` :binary_id; `approved_by` :binary_id; `account_id` :integer; `user_id` :integer
- Índices/chaves: index [:institution_id, :fee_type, :client_type, :member_status, :is_active]; index [:effective_from, :effective_until]; index [:account_id, :fee_type, :client_type]; index [:user_id, :fee_type, :client_type]

### `fee_exports`
- Módulo: `Monetarie.Schemas.Fees.FeeExport` (`core/backend/lib/monetarie/schemas/fees/fee_export.ex:24`)
- Propósito: Rastreia jobs de exportação detalhada, linha a linha, do relatório de tarifas cobradas por conta e período.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :string; `date_from` :date; `date_to` :date; `status` :string (default: "pending"); `file_path` :string; `row_count` :integer; `byte_size` :integer; `error` :string; `requested_by` :string; `entity_id` Ecto.UUID; `finished_at` :utc_datetime_usec
- Índices/chaves: index [:account_id, :inserted_at]; index [:status]

### `fee_package_assignments`
- Módulo: `Monetarie.Schemas.Fees.FeePackageAssignment` (`core/backend/lib/monetarie/schemas/fees/fee_package_assignment.ex:8`)
- Propósito: Vínculo entre cliente e pacote de tarifas, com período de vigência, status de ativação e responsável pela atribuição.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `package_id` :binary_id; `user_id` :integer; `effective_from` :date; `effective_until` :date; `is_active` :boolean (default: true); `created_by` :binary_id
- Índices/chaves: index [:package_id]; unique [:institution_id, :user_id]

### `fee_package_consumptions`
- Módulo: `Monetarie.Schemas.Fees.FeePackageConsumption` (`core/backend/lib/monetarie/schemas/fees/fee_package_consumption.ex:8`)
- Propósito: Consumo de pacotes de tarifas por cliente e mês, associando a transação de origem que gerou ou foi coberta pela cobrança.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (inserted_at: :created_at, updated_at: false, type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `user_id` :integer; `package_id` :binary_id; `fee_type` :string; `reference_month` :date; `origin_transaction_id` :string; `origin_transaction_type` :string; `covered_mode` :string
- Índices/chaves: unique [:origin_transaction_id, :fee_type]; index [:institution_id, :user_id, :fee_type, :reference_month]

### `fee_package_items`
- Módulo: `Monetarie.Schemas.Fees.FeePackageItem` (`core/backend/lib/monetarie/schemas/fees/fee_package_item.ex:8`)
- Propósito: Itens de um pacote de tarifas, definindo tipo de tarifa, modo de cobrança e quantidade de isenções gratuitas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `package_id` :binary_id; `fee_config_id` :binary_id; `fee_type` :string; `mode` :string; `free_count` :integer; `charge_immediately` :boolean (default: false)
- Índices/chaves: unique [:package_id, :fee_type]

### `fee_packages`
- Módulo: `Monetarie.Schemas.Fees.FeePackage` (`core/backend/lib/monetarie/schemas/fees/fee_package.ex:8`)
- Propósito: Pacotes de tarifas cobradas mensalmente de clientes, com preço, dia de cobrança, vigência e itens incluídos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `name` :string; `monthly_price` :integer (default: 0); `billing_day` :integer (default: 1); `is_active` :boolean (default: true); `is_default` :boolean (default: false); `effective_from` :date; `effective_until` :date; `billing_period` :string (default: "monthly"); `created_by` :binary_id; `items` {:array, :map} (default: []); `assignment_count` :integer (default: 0); `total_price` :integer (default: 0)
- Índices/chaves: index [:institution_id, :is_active]; unique [:institution_id]

### `fee_split_configs`
- Módulo: `Monetarie.Schemas.Fees.FeeSplitConfig` (`core/backend/lib/monetarie/schemas/fees/fee_split_config.ex:37`)
- Propósito: Configuração declarativa de rateio de tarifas por lojista ou conta, com participantes, tipo de cálculo e valor.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps
- Colunas: `entity_id` Ecto.UUID; `merchant_id` :string; `account_id` :integer; `fee_type` :string; `splits` {:array, :map} (default: []); `is_active` :boolean (default: true); `description` :string
- Índices/chaves: index [:entity_id, :fee_type]; index [:merchant_id, :fee_type]; unique [:entity_id, :merchant_id, :fee_type]; unique [:entity_id, :account_id, :fee_type]

### `fee_split_transactions`
- Módulo: `Monetarie.Schemas.Fees.FeeSplitTransaction` (`core/backend/lib/monetarie/schemas/fees/fee_split_transaction.ex:23`)
- Propósito: Registra uma perna de rateio de tarifa por destinatário e transação de origem, com valor, tipo e regra de cálculo.
- Chave/particionamento: PK `false`; particionada por RANGE mensal (migrations `20260704133000`)
- Colunas: `id` :binary_id (primary_key: true, autogenerate: true); `charged_at` :naive_datetime (primary_key: true); `transaction_id` :binary; `end_to_end_id` :string; `split_config_id` Ecto.UUID; `recipient_account_id` :integer; `recipient_label` :string; `amount` :integer; `calc_type` :string; `calc_value` :integer; `total_fee` :integer; `entity_id` Ecto.UUID; `tb_transfer_id` :binary

### `fee_transactions`
- Módulo: `Monetarie.Schemas.Fees.FeeTransaction` (`core/backend/lib/monetarie/schemas/fees/fee_transaction.ex:26`)
- Propósito: Cobranças individuais de tarifas lançadas nas contas dos clientes, vinculadas à transação de origem e ao lançamento no ledger TigerBeetle.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (inserted_at: :created_at, updated_at: false, type: :utc_datetime); particionada por RANGE mensal (migrations `20260704133000`)
- Colunas: `institution_id` :binary_id; `account_id` :string; `client_id` :binary_id; `fee_config_id` :binary_id; `origin_transaction_id` :string; `origin_transaction_type` :string; `origin_amount` :integer (default: 0); `fee_amount` :integer; `tb_transfer_id` :integer; `tb_revenue_account_code` :integer; `act_type` :string; `is_member` :boolean; `member_id` :binary_id; `cosif_debit` :string; `cosif_credit_coop` :string; `cosif_credit_non_coop` :string; `fee_type` :string; `status` :string (default: "posted"); `reversed_at` :utc_datetime; `reversal_reason` :string; `reversal_tb_transfer_id` :integer

### `fee_type_categories`
- Módulo: `Monetarie.Schemas.Fees.FeeTypeCategory` (`core/backend/lib/monetarie/schemas/fees/fee_type_category.ex:10`)
- Propósito: Associa tipos de tarifa a categorias de classificação por instituição, usado na organização de relatórios de receita de tarifas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `institution_id` :binary_id; `fee_type` :string; `category_id` :binary_id
- Índices/chaves: unique [:institution_id, :fee_type]; index [:category_id]

### `invoices`
- Módulo: `Monetarie.Schemas.Billing.Invoice` (`core/backend/lib/monetarie/schemas/billing/invoice.ex:46`)
- Propósito: Faturas mensais de cobrança do modelo BaaS por instituição cliente, consolidando tarifa fixa, tarifas por transação, descontos e impostos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tenant_id` :binary_id; `billing_plan_id` :binary_id; `invoice_number` :string; `period_start` :date; `period_end` :date; `status` :string (default: "draft"); `base_fee` :integer (default: 0); `transaction_fees` :integer (default: 0); `volume_discounts` :integer (default: 0); `taxes` :integer (default: 0); `total_amount` :integer; `due_date` :date; `paid_at` :utc_datetime_usec; `line_items` :map (default: %{}); `metadata` :map (default: %{})
- Índices/chaves: unique [invoice_number]; index [tenant_id, period_start]; unique [tenant_id, period_start, period_end]; FK `billing_plan_id` → `billing_plans`; FK `tenant_id` → `tenants`

## 5. Compliance, PLD/FT, LGPD e judicial

### `compliance_case_actions`
- Módulo: `Monetarie.Schemas.Compliance.ComplianceCaseAction` (`core/backend/lib/monetarie/schemas/compliance/compliance_case_action.ex:18`)
- Propósito: Linha do tempo de ações realizadas em um caso de compliance/PLD-FT, registrando mudança de status e observações.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec, updated_at: false)
- Colunas: `action_type` :string; `from_status` :string; `to_status` :string; `note` :string; `metadata` :map (default: %{}); `case_id` belongs_to `ComplianceCase`; `actor_id` belongs_to `Admin`
- Índices/chaves: index [:case_id, :inserted_at]; index [:actor_id]

### `compliance_case_evidence`
- Módulo: `Monetarie.Schemas.Compliance.ComplianceCaseEvidence` (`core/backend/lib/monetarie/schemas/compliance/compliance_case_evidence.ex:17`)
- Propósito: Evidências anexadas a um caso de compliance ou PLD/FT, com tipo, referência e conteúdo do documento probatório.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `evidence_type` :string; `reference_id` :string; `description` :string; `payload` :map (default: %{}); `case_id` belongs_to `ComplianceCase`; `added_by_id` belongs_to `Admin`
- Índices/chaves: index [:case_id, :inserted_at]; index [:evidence_type]

### `compliance_cases`
- Módulo: `Monetarie.Schemas.Compliance.ComplianceCase` (`core/backend/lib/monetarie/schemas/compliance/compliance_case.ex:22`)
- Propósito: Casos de investigação de compliance usados em apurações de PLD/FT, RC6 e investigações manuais, com decisão e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `subject_document` :string; `subject_name` :string; `title` :string; `summary` :string; `source` :string (default: "manual"); `status` :string (default: "open"); `priority` :string (default: "medium"); `decision` :string; `decision_reason` :string; `decided_at` :utc_datetime_usec; `closed_at` :utc_datetime_usec; `metadata` :map (default: %{}); `opened_by_id` belongs_to `Admin`; `assigned_to_id` belongs_to `Admin`; `decided_by_id` belongs_to `Admin`
- Índices/chaves: index [:entity_id, :status]; index [:entity_id, :subject_document]; index [:entity_id, :priority]; index [:inserted_at]

### `edd_assessments`
- Módulo: `Monetarie.Schemas.Compliance.EddAssessment` (`core/backend/lib/monetarie/schemas/compliance/edd_assessment.ex:22`)
- Propósito: Avaliações de Diligência Reforçada (EDD) de clientes de risco elevado para PLD/FT, com achados e conclusão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `risk_level` :string; `trigger_reason` :string; `assessor_user_id` :integer; `assessment_date` :date; `next_review_date` :date; `status` :string (default: "pending"); `findings` :string; `documents_requested` {:array, :string} (default: []); `documents_received` {:array, :string} (default: []); `conclusion` :string; `metadata` :map (default: %{}); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`

### `judicial_balance_locks` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142218_create_judicial_balance_locks.exs`
- Propósito: Bloqueios judiciais de saldo vinculados a ordens SISBAJUD, tabela do baseline acessada via SQL.
- Colunas: `id` :binary_id; `account_id` references(:accounts; `order_id` references(:judicial_orders; `locked_at` :utc_datetime; `expires_at` :utc_datetime; `reason` :string; `released_at` :utc_datetime
- Índices/chaves: index [:account_id, :expires_at]; index [:order_id]

### `judicial_blocks`
- Módulo: `Monetarie.Schemas.Judicial.JudicialBlock` (`core/backend/lib/monetarie/schemas/judicial/judicial_block.ex:44`)
- Propósito: Bloqueios judiciais de valores em conta (SISBAJUD/ordem judicial), com valor bloqueado, vínculo ao ledger e motivo de liberação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `account_id` :integer; `blocked_amount` :integer; `tb_transfer_id` :string; `status` :string (default: "active"); `released_at` :utc_datetime_usec; `release_reason` :string; `tipo_ativo` Ecto.Enum (default: :cc); `salary_account_flag` :boolean (default: false); `liquidez_score` :integer (default: 100); `valor_remanescente_centavos` :integer; `order_id` belongs_to `Monetarie.Schemas.Judicial.JudicialOrder`
- Índices/chaves: index [:tipo_ativo]; FK `order_id` → `judicial_orders`

### `judicial_contacts` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142214_create_judicial_contacts.exs`
- Propósito: Contatos de comunicação com o Poder Judiciário para o fluxo SISBAJUD (baseline).
- Colunas: `id` :binary_id; `id_contato` :string; `nome_contato` :string; `ddd` :string; `telefone` :string; `email` :string; `ativo` :boolean; `last_validation_code` :string; `last_validation_at` :utc_datetime; `sent_to_sisbajud_at` :utc_datetime
- Índices/chaves: unique [:id_contato]

### `judicial_courts` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142213_create_judicial_courts.exs`
- Propósito: Cadastro de varas e tribunais de origem de ordens judiciais SISBAJUD (baseline).
- Colunas: `id` :binary_id; `codigo_vara_juizo` :string; `nome_vara_juizo` :string; `tribunal` :string; `endereco` :string; `telefone` :string; `fax` :string; `email` :string; `tipo_justica` :string; `situacao_vara_juizo` :string; `numero_judiciario_tribunal` :string; `numero_judiciario_vara` :string; `last_synced_at` :utc_datetime
- Índices/chaves: unique [:codigo_vara_juizo]

### `judicial_file_validations` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142215_create_judicial_file_validations.exs`
- Propósito: Resultados de validação de arquivos de ordens judiciais SISBAJUD recebidos (baseline).
- Colunas: `id` :binary_id; `file_id` :binary_id; `tipo_arquivo` :string; `data_movimento` :date; `registros` :map; `processado_em` :utc_datetime
- Índices/chaves: index [:tipo_arquivo, :data_movimento]

### `judicial_info_requests` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142216_create_judicial_info_requests.exs`
- Propósito: Pedidos de informação do Judiciário (requisições de dados de clientes e contas) no fluxo SISBAJUD (baseline).
- Colunas: `id` :binary_id; `protocolo` :string; `sequencial` :integer; `cpf_cnpj_pesquisado` :string; `indicador_pessoa` :string; `pesquisar_enderecos` :boolean; `pesquisar_saldo` :boolean; `pesquisar_agencias_contas` :boolean; `extrato_contas_correntes` :boolean; `extrato_contas_poupanca` :boolean; `extrato_contas_investimento` :boolean; `extrato_outros_ativos` :boolean; `relacionamentos_encerrados` :boolean; `limite_valor_saldo_centavos` :bigint; `data_inicial_extrato` :date; `data_final_extrato` :date; `status` :string; `response_code` :string; `responded_at` :utc_datetime
- Índices/chaves: unique [:protocolo, :sequencial]

### `judicial_orders`
- Módulo: `Monetarie.Schemas.Judicial.JudicialOrder` (`core/backend/lib/monetarie/schemas/judicial/judicial_order.ex:62`)
- Propósito: Ordens judiciais de bloqueio e penhora recebidas via SISBAJUD, com valor solicitado, valor bloqueado, prazo de resposta e protocolo BACEN.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `order_number` :string; `court_code` :string; `order_type` :string; `document_number` SisbajudEncryptedDocument; `document_number_hash` :binary; `requested_amount` :integer; `blocked_amount` :integer (default: 0); `status` :string (default: "received"); `received_at` :utc_datetime_usec; `response_deadline` :utc_datetime_usec; `responded_at` :utc_datetime_usec; `bcb_protocol` :string; `response_content` :string; `metadata` :map (default: %{}); `reiteracao_bloqueio` :integer (default: 0); `id_transferencia` :string; `ordem_cancelada` :boolean (default: false); `vara_juizo_codigo` :string; `cnpj_destino` :string; `data_horario_protocolizacao` :utc_datetime_usec; `protocolo` :string; `sequencial_bloqueio` :integer; `cpf_cnpj_reu` SisbajudEncryptedDocument; `cpf_cnpj_reu_hash` :binary; `indicador_cpf_cnpj_reu` :string
- Índices/chaves: index [:document_number_hash]; index [:cpf_cnpj_reu_hash, :indicador_cpf_cnpj_reu]

### `judicial_pending_files` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260426142217_create_judicial_pending_files.exs`
- Propósito: Arquivos SISBAJUD pendentes de processamento ou resposta (baseline).
- Colunas: `id` :binary_id; `tipo_arquivo` :string; `file_name` :string; `content_bytes` :binary; `content_type` :string; `status` :string; `tentativas` :integer; `last_attempt_at` :utc_datetime; `error_message` :string; `related_validation_id` :binary_id
- Índices/chaves: index [:status, :tipo_arquivo]; unique [:file_name]

### `lgpd_anonymization_logs`
- Módulo: `Monetarie.Schemas.Lgpd.AnonymizationLog` (`core/backend/lib/monetarie/schemas/lgpd/anonymization_log.ex:25`)
- Propósito: Registra solicitações de anonimização e exclusão de dados pessoais conforme a LGPD, com campos afetados e prazo de retenção.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `user_id` :integer; `status` :string (default: "requested"); `immediate_fields` :map (default: %{}); `deferred_fields` :map (default: %{}); `retention_until` :utc_datetime; `reason` :string (default: "data_subject_request"); `executed_by` :string (default: "system"); `completed_at` :utc_datetime
- Índices/chaves: index [:user_id]; index [:status]

### `lgpd_data_exports`
- Módulo: `Monetarie.Schemas.Lgpd.DataExport` (`core/backend/lib/monetarie/schemas/lgpd/data_export.ex:26`)
- Propósito: Solicitações de exportação de dados pessoais para portabilidade LGPD, com formato, seções incluídas e prazo de expiração do arquivo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `user_id` :integer; `format` :string; `status` :string (default: "pending"); `file_path` :string; `file_size` :integer; `sections` :map (default: %{}); `expires_at` :utc_datetime; `error_message` :string
- Índices/chaves: index [:user_id]; index [:status]

### `lgpd_retention_policies`
- Módulo: `Monetarie.Schemas.Lgpd.RetentionPolicy` (`core/backend/lib/monetarie/schemas/lgpd/retention_policy.ex:14`)
- Propósito: Políticas de retenção de dados pessoais conforme a LGPD, com categoria de dado, prazo de retenção e base legal.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `data_category` :string; `retention_years` :integer; `legal_basis` :string; `description` :string
- Índices/chaves: unique [:data_category]

### `monitoring_rules`
- Módulo: `Monetarie.Schemas.Compliance.MonitoringRule` (`core/backend/lib/monetarie/schemas/compliance/monitoring_rule.ex:17`)
- Propósito: Regras de monitoramento transacional para detecção de padrões suspeitos, com tipo, severidade e parâmetros configuráveis.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `rule_type` :string; `parameters` :map (default: %{}); `severity` :string (default: "medium"); `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [code]

### `pep_records`
- Módulo: `Monetarie.Schemas.Compliance.PepRecord` (`core/backend/lib/monetarie/schemas/compliance/pep_record.ex:17`)
- Propósito: Cadastro de Pessoas Politicamente Expostas (PEP) para fins de PLD/FT, com cargo, instituição, vínculo e vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `document_number` :string; `name` :string; `position` :string; `institution` :string; `relationship_type` :string; `start_date` :date; `end_date` :date; `source` :string; `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [document_number, "position"]; index [document_number]

### `sanctioned_entities`
- Módulo: `Monetarie.Schemas.Compliance.SanctionedEntity` (`core/backend/lib/monetarie/schemas/compliance/sanctioned_entity.ex:17`)
- Propósito: Lista de pessoas e organizações sancionadas em listas restritivas, usada nas checagens de prevenção à lavagem de dinheiro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `document_number` :string; `name` :string; `aliases` {:array, :string} (default: []); `source` :string; `source_id` :string; `entity_type` :string; `country` :string; `reason` :string; `listed_at` :utc_datetime_usec; `delisted_at` :utc_datetime_usec; `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: index [document_number]; index [is_active]; index [name]; index [source]; unique [source, source_id) WHERE (source_id IS NOT NULL]

### `sanctions_checks`
- Módulo: `Monetarie.Schemas.Compliance.SanctionsCheck` (`core/backend/lib/monetarie/schemas/compliance/sanctions_check.ex:17`)
- Propósito: Resultados de checagem de listas de sanções para PLD/FT por documento, com score de correspondência e entidade encontrada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `document_number` :string; `name` :string; `check_type` :string; `result` :string; `match_score` :decimal; `matched_entity` :string; `checked_at` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [checked_at]; index [document_number]

### `suspicious_activities`
- Módulo: `Monetarie.Schemas.Compliance.SuspiciousActivity` (`core/backend/lib/monetarie/schemas/compliance/suspicious_activity.ex:22`)
- Propósito: Registros de atividades suspeitas de PLD/FT vinculadas a transação, conta ou documento, com severidade e revisão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `entity_id` Ecto.UUID; `transaction_id` :binary_id; `account_id` :integer; `document_number` :string; `activity_type` :string; `severity` :string (default: "medium"); `amount` :integer; `description` :string; `rule_id` :string; `status` :string (default: "pending"); `reviewer_id` :binary_id; `reviewed_at` :utc_datetime_usec; `coaf_report_id` :string; `coaf_status` :string (default: "not_generated"); `coaf_generated_at` :utc_datetime_usec; `coaf_submitted_at` :utc_datetime_usec; `coaf_accepted_at` :utc_datetime_usec; `coaf_rejected_at` :utc_datetime_usec; `coaf_protocol` :string; `coaf_rejection_reason` :string; `reported_at` :utc_datetime_usec; `metadata` :map (default: %{}); `case_id` belongs_to `ComplianceCase`
- Índices/chaves: index [:case_id]; index [:coaf_status]; index [:entity_id, :coaf_status]

### `user_consents`
- Módulo: `Monetarie.Schemas.Lgpd.Consent` (`core/backend/lib/monetarie/schemas/lgpd/consent.ex:19`)
- Propósito: Consentimentos do usuário para tratamento de dados pessoais conforme a LGPD (Lei 13.709/2018), com tipo, data e revogação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `user_id` :integer; `consent_type` :string; `granted` :boolean (default: true); `granted_at` :utc_datetime; `revoked_at` :utc_datetime; `ip_address` :string; `user_agent` :string; `metadata` :map (default: %{})
- Índices/chaves: index [:user_id]; unique [:user_id, :consent_type]

## 6. Admin, autenticação, RBAC e auditoria

### `approval_requests`
- Módulo: `Monetarie.Schemas.Approvals.ApprovalRequest` (`core/backend/lib/monetarie/schemas/approvals/approval_request.ex:41`)
- Propósito: Registra solicitações de aprovação no modelo maker-checker, com solicitante, aprovador, tipo de operação e resultado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `operation_type` :string; `status` :string (default: "pending"); `priority` :string (default: "normal"); `maker_id` :binary_id; `maker_name` :string; `maker_reason` :string; `checker_id` :binary_id; `checker_name` :string; `checker_comment` :string; `operation_payload` :map (default: %{}); `operation_result` :map; `entity_id` :binary_id; `tenant_id` :binary_id; `resource_type` :string; `resource_id` :string; `expires_at` :utc_datetime; `decided_at` :utc_datetime; `executed_at` :utc_datetime; `ip_address` :string; `user_agent` :string
- Índices/chaves: index [entity_id]; index [maker_id]; index [operation_type]; index [status, expires_at]; index [status]; index [tenant_id]

### `audit_logs`
- Módulo: `Monetarie.Schemas.Audit.AuditLog` (`core/backend/lib/monetarie/schemas/audit/audit_log.ex:42`)
- Propósito: Trilha de auditoria de ações realizadas no sistema, com ator, recurso afetado, alterações e endereço IP.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `action` :string; `resource_type` :string; `resource_id` :string; `actor_type` :string; `actor_id` :string; `changes` :map (default: %{}); `metadata` :map (default: %{}); `ip_address` Monetarie.UseCases.Audit.InetType; `inserted_at` :utc_datetime
- Índices/chaves: index [action]; index [entity_id]; index [actor_type, actor_id]; index [resource_type, resource_id]; index [inserted_at]; FK `entity_id` → `entities`

### `collaborator_invites`
- Módulo: `Monetarie.Schemas.Collaborators.Invite` (`core/backend/lib/monetarie/schemas/collaborators/invite.ex:5`)
- Propósito: Convites enviados a colaboradores para ingressar em uma entidade, com papel atribuído, token de aceite e prazo de expiração.
- Chave/particionamento: PK `id` binary_id (padrão); timestamps (type: :utc_datetime)
- Colunas: `entity_id` :binary_id; `invited_by_user_id` :integer; `email` :string; `role` :string; `token` :string; `status` :string (default: "pending"); `accepted_at` :utc_datetime; `expires_at` :utc_datetime
- Índices/chaves: index [email]; index [entity_id]; unique [token]; FK `entity_id` → `entities`; FK `invited_by_user_id` → `users`

### `employees`
- Módulo: `Monetarie.Schemas.HR.Employee` (`core/backend/lib/monetarie/schemas/hr/employee.ex:10`)
- Propósito: Cadastro de colaboradores da instituição, com CPF, cargo, departamento, data de admissão e vínculo com usuário administrador.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `cpf` :string; `email` :string; `phone` :string; `role` :string; `department` :string; `admission_date` :date; `active` :boolean (default: true); `platform_admin_id` :binary_id
- Índices/chaves: unique [:cpf]; index [:active]; index [:role]

### `features`
- Módulo: `Monetarie.Schemas.Rbac.Feature` (`core/backend/lib/monetarie/schemas/rbac/feature.ex:14`)
- Propósito: Funcionalidades (telas) do controle de acesso RBAC dentro de cada módulo, com rota, ícone e permissão exigida.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `feature_type` :string; `route_path` :string; `icon` :string; `display_order` :integer (default: 0); `is_active` :boolean (default: true); `requires_permission` :boolean (default: true); `metadata` :map (default: %{}); `module_id` belongs_to `Monetarie.Schemas.Rbac.Module`
- Índices/chaves: unique [:code]; index [:module_id]

### `group_features`
- Módulo: `Monetarie.Schemas.Rbac.GroupFeature` (`core/backend/lib/monetarie/schemas/rbac/group_feature.ex:13`)
- Propósito: Vincula grupos de acesso a funcionalidades do sistema, com permissões granulares de visualizar, criar, editar, excluir, aprovar e configurar.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `can_view` :boolean (default: false); `can_create` :boolean (default: false); `can_edit` :boolean (default: false); `can_delete` :boolean (default: false); `can_approve` :boolean (default: false); `can_configure` :boolean (default: false); `can_export` :boolean (default: false); `metadata` :map (default: %{}); `group_id` belongs_to `Monetarie.Schemas.Rbac.Group`; `feature_id` belongs_to `Monetarie.Schemas.Rbac.Feature`
- Índices/chaves: unique [:group_id, :feature_id]; index [:feature_id]

### `groups`
- Módulo: `Monetarie.Schemas.Rbac.Group` (`core/backend/lib/monetarie/schemas/rbac/group.ex:14`)
- Propósito: Grupos de permissão RBAC (controle de acesso baseado em papéis) usados para autorização de administradores no backoffice.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `is_system` :boolean (default: false); `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [:code]; index [:is_active]

### `ip_whitelist_rules`
- Módulo: `Monetarie.Schemas.Security.IpWhitelistRule` (`core/backend/lib/monetarie/schemas/security/ip_whitelist_rule.ex:18`)
- Propósito: Regras de whitelist de IP por entidade para segurança de acesso administrativo e de API, com CIDR e validade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cidr` :string; `description` :string; `scope` :string (default: "api"); `active` :boolean (default: true); `expires_at` :utc_datetime_usec; `entity_id` belongs_to `Entity`; `created_by_admin_id` belongs_to `Admin`
- Índices/chaves: unique [:entity_id, :scope, :cidr]; index [:entity_id, :scope, :active]; index [:entity_id, :expires_at]; index [:created_by_admin_id]

### `modules`
- Módulo: `Monetarie.Schemas.Rbac.Module` (`core/backend/lib/monetarie/schemas/rbac/module.ex:13`)
- Propósito: Módulos do controle de acesso baseado em papéis (RBAC), seções de alto nível do sistema como dashboard e crédito.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `icon` :string; `display_order` :integer (default: 0); `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [:code]

### `password_reset_tokens`
- Módulo: `Monetarie.Schemas.Auth.PasswordResetToken` (`core/backend/lib/monetarie/schemas/auth/password_reset_token.ex:8`)
- Propósito: Tokens de redefinição de senha de usuários, com hash do token, prazo de expiração e marca de utilização.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `user_id` :integer; `token_hash` :string; `expires_at` :utc_datetime; `used_at` :utc_datetime
- Índices/chaves: index [:user_id]; index [:token_hash]

### `platform_admin_groups`
- Módulo: `Monetarie.Schemas.Rbac.PlatformAdminGroup` (`core/backend/lib/monetarie/schemas/rbac/platform_admin_group.ex:13`)
- Propósito: Tabela de junção entre administradores da plataforma e grupos RBAC, indicando qual é o grupo primário do administrador.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `is_primary` :boolean (default: false); `metadata` :map (default: %{}); `platform_admin_id` belongs_to `Monetarie.Schemas.Platform.Admin`; `group_id` belongs_to `Monetarie.Schemas.Rbac.Group`
- Índices/chaves: unique [:platform_admin_id, :group_id]; index [:group_id]

### `platform_admin_sessions` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260309011458_create_platform_admins.exs`
- Propósito: Sessões de administradores da plataforma do baseline legado, sem schema Ecto no código atual.
- Colunas: `id` :uuid; `admin_id` references(:platform_admins; `token_jti` :string; `ip_address` :string; `user_agent` :string; `expires_at` :utc_datetime; `revoked_at` :utc_datetime
- Índices/chaves: index [:admin_id]; unique [:token_jti]; index [:expires_at]

### `platform_admins`
- Módulo: `Monetarie.Schemas.Platform.Admin` (`core/backend/lib/monetarie/schemas/platform/admin.ex:28`)
- Propósito: Administradores da plataforma (backoffice), com papel de acesso, autenticação MFA/TOTP e controle de troca obrigatória de senha.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `email` :string; `name` :string; `password_hash` :string; `role` :string (default: "admin"); `totp_secret` :binary; `totp_enabled` :boolean (default: false); `mfa_backup_codes` {:array, :string} (default: []); `mfa_enforced` :boolean (default: true); `status` :string (default: "active"); `must_change_password` :boolean (default: true); `password_changed_at` :utc_datetime; `last_login_at` :utc_datetime; `last_login_ip` :string; `failed_login_attempts` :integer (default: 0); `locked_until` :utc_datetime; `created_by` :binary_id; `notes` :string; `password` :string; `password_confirmation` :string; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: unique [:email]; index [:status]; index [:role]; index [:institution_id]

### `user_otp_settings`
- Módulo: `Monetarie.Schemas.Auth.OTPSettings` (`core/backend/lib/monetarie/schemas/auth/otp_settings.ex:14`)
- Propósito: Configurações de senha de uso único (OTP) do usuário, com segredo criptografado, telefone e códigos de backup.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `otp_type` :string (default: "totp"); `otp_secret_encrypted` :binary; `otp_backup_codes_encrypted` :binary; `phone_number` :string; `enabled` :boolean (default: false); `verified_at` :utc_datetime; `last_used_at` :utc_datetime; `user_id` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: unique [:user_id]; index [:otp_type]

## 7. Webhooks, eventos e infraestrutura de mensageria

### `events`
- Módulo: `Monetarie.Schemas.Events.Event` (`core/backend/lib/monetarie/schemas/events/event.ex:28`)
- Propósito: Registro unificado de eventos de mensageria do Sistema Financeiro Nacional (SFN/BACEN), com tipo, direção, status e código de erro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `event_type` :string; `source_group` :string; `message_code` :string; `message_type` :string; `direction` :string (default: "inbound"); `status` :string (default: "RECEBIDA"); `previous_status` :string; `bcb_error_code` :string; `bcb_error_description` :string; `correlation_id` :string; `msg_id` :string; `num_ctrl` :string; `ispb` :string; `sender_ispb` :string; `receiver_ispb` :string; `amount` :decimal; `currency` :string (default: "BRL"); `received_at` :utc_datetime_usec; `processed_at` :utc_datetime_usec; `responded_at` :utc_datetime_usec; `latency_ms` :integer; `retry_count` :integer (default: 0); `metadata` :map (default: %{}); `entity_id` :binary_id
- Índices/chaves: index [correlation_id]; index [direction]; index [entity_id]; index [entity_id, source_group, received_at]; index [ispb]; index [msg_id]; index [num_ctrl]; index [received_at]; index [source_group]; index [source_group, received_at]; index [source_group, status]; index [status]

### `nats_dead_letters`
- Módulo: `Monetarie.Schemas.Infra.Nats.DeadLetter` (`core/backend/lib/monetarie/schemas/infra/nats/dead_letter.ex:7`)
- Propósito: Mensagens NATS que falharam no processamento após esgotar as tentativas de reprocessamento, guardadas para análise manual.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `topic` :string; `payload` :map; `error` :string; `attempts` :integer; `consumer` :string; `replayed_at` :utc_datetime
- Índices/chaves: index [replayed_at) WHERE (replayed_at IS NULL]; index [inserted_at]; index [topic]

### `processed_messages` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Deduplicação de mensagens NATS já processadas pelos consumers duráveis (Monetarie.Infra.Nats.MessageDedup).
- Colunas: `id` uuid NOT NULL; `message_id` character varying(255) NOT NULL; `entity_id` uuid; `source` character varying(255) NOT NULL; `subject` character varying(255); `processed_at` timestamp(0) without time zone DEFAULT now() NOT NULL
- Índices/chaves: index [entity_id]; unique [message_id, source]; index [processed_at]; FK `entity_id` → `entities`

### `webhook_deliveries`
- Módulo: `Monetarie.Schemas.Webhooks.Delivery` (`core/backend/lib/monetarie/schemas/webhooks/delivery.ex:7`)
- Propósito: Entregas de webhooks a parceiros, com tipo de evento, tentativas, status e horário de resposta e agendamento de reenvio.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `event_id` :string; `payload` :map; `status` :string (default: "pending"); `attempts` :integer (default: 0); `last_attempt_at` :utc_datetime; `next_retry_at` :utc_datetime; `response_status` :integer; `response_body` :string; `response_time_ms` :integer; `error_message` :string; `replayed_at` :utc_datetime; `webhook_id` belongs_to `Monetarie.Schemas.Webhooks.Webhook`
- Índices/chaves: unique [:webhook_id, :event_id]; index [:status, :next_retry_at]; FK `webhook_id` → `webhooks`

### `webhook_delivery_stats`
- Módulo: `Monetarie.Schemas.Webhooks.DeliveryStats` (`core/backend/lib/monetarie/schemas/webhooks/delivery_stats.ex:10`)
- Propósito: Contadores pré-computados de entrega de um webhook, com total, sucesso, falha e data da última tentativa.
- Chave/particionamento: PK `{:webhook_id, :binary_id, autogenerate: false}`; timestamps (type: :utc_datetime)
- Colunas: `total_deliveries` :integer; `delivered_count` :integer; `failed_count` :integer; `failing_count` :integer; `recent_total` :integer; `recent_delivered` :integer; `recent_failed` :integer; `last_delivery_at` :utc_datetime

### `webhooks`
- Módulo: `Monetarie.Schemas.Webhooks.Webhook` (`core/backend/lib/monetarie/schemas/webhooks/webhook.ex:7`)
- Propósito: Configuração de webhooks de merchants para notificação de eventos, com URL de destino, segredo criptografado e lista de eventos assinados.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `url` :string; `encrypted_secret` :string; `secret_hash` :string; `events` {:array, :string} (default: []); `description` :string; `is_active` :boolean (default: true); `metadata` :map (default: %{}); `merchant_id` :integer; `secret` :string; `api_key_id` belongs_to `Monetarie.Schemas.ApiKeys.ApiKey`
- Índices/chaves: index [api_key_id]; index [entity_id]; index [is_active]; index [merchant_id]; FK `merchant_id` → `users`; FK `api_key_id` → `api_keys`; FK `entity_id` → `entities`

## 8. Partner API, tenants BaaS e merchants

### `api_keys`
- Módulo: `Monetarie.Schemas.ApiKeys.ApiKey` (`core/backend/lib/monetarie/schemas/api_keys/api_key.ex:19`)
- Propósito: Guarda chaves de API de merchants e parceiros, com credenciais de cliente, permissões, whitelist de IP e prazo de expiração.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `merchant_id` :integer; `partner_id` Ecto.UUID; `name` :string; `client_id` :string; `client_secret_hash` :string; `client_secret_prefix` :string; `permissions` {:array, :string} (default: []); `status` :string (default: "active"); `ip_whitelist` {:array, :string}; `expires_at` :utc_datetime; `last_used_at` :utc_datetime
- Índices/chaves: index [:partner_id]; FK `merchant_id` → `users`

### `ecosystem_modules`
- Módulo: `Monetarie.Schemas.Ecosystem.Module` (`core/backend/lib/monetarie/schemas/ecosystem/module.ex:39`)
- Propósito: Catálogo dos módulos do ecossistema Monetarie, com URLs de frontend e backend, endpoint de saúde e prefixo de assunto NATS.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `code` :string; `name` :string; `description` :string; `icon` :string; `color` :string; `frontend_url` :string; `backend_url` :string; `health_endpoint` :string (default: "/health"); `nats_subject_prefix` :string; `sso_target` :string; `is_enabled` :boolean (default: true); `is_simulator` :boolean (default: false); `display_order` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: unique [code]; index [display_order]; index [is_enabled]; index [is_simulator]; unique [sso_target) WHERE (sso_target IS NOT NULL]

### `merchant_configs`
- Módulo: `Monetarie.Schemas.Settings.MerchantConfig` (`core/backend/lib/monetarie/schemas/settings/merchant_config.ex:15`)
- Propósito: Configuração operacional por lojista exposta no backoffice administrativo, com habilitação de PIX, limites e URLs de webhook.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `pix_enabled` :boolean (default: true); `pix_in_enabled` :boolean (default: true); `pix_out_enabled` :boolean (default: true); `max_transaction_amount` :integer; `daily_limit` :integer; `monthly_limit` :integer; `webhook_url` :string; `callback_url` :string; `auto_approve` :boolean (default: false); `accept_pix_in_without_txid` :boolean (default: false); `metadata` :map (default: %{}); `entity_id` belongs_to `Entity`; `merchant_id` belongs_to `User`
- Índices/chaves: unique [:entity_id, :merchant_id]; index [:entity_id, :pix_enabled]; index [:entity_id, :auto_approve]

### `merchant_providers`
- Módulo: `Monetarie.Schemas.Settings.MerchantProvider` (`core/backend/lib/monetarie/schemas/settings/merchant_provider.ex:15`)
- Propósito: Configuração de roteamento de provedores de pagamento atribuídos a um lojista no backoffice administrativo, com prioridade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `provider_id` :string; `provider_name` :string; `priority` :integer; `enabled` :boolean (default: true); `config` :map (default: %{}); `entity_id` belongs_to `Entity`; `merchant_id` belongs_to `User`
- Índices/chaves: unique [:entity_id, :merchant_id, :provider_id]; index [:entity_id, :merchant_id, :enabled]; index [:entity_id, :merchant_id, :priority]

### `partners`
- Módulo: `Monetarie.Schemas.Partners.Partner` (`core/backend/lib/monetarie/schemas/partners/partner.ex:21`)
- Propósito: Fintechs parceiras que integram aplicativo, internet banking ou CRM próprios ao Core via API server-to-server, com documento e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `document` :string; `status` :string (default: "active"); `metadata` :map; `entity_id` belongs_to `Entity`
- Índices/chaves: unique [:entity_id, :document]; index [:status]

### `providers_health_checks`
- Módulo: `Monetarie.Schemas.Providers.HealthCheck` (`core/backend/lib/monetarie/schemas/providers/health_check.ex:16`)
- Propósito: Registros de checagem de saúde de provedores externos integrados, com tempo de resposta e mensagem de erro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `provider` :string; `entity_id` Ecto.UUID; `status` :string; `response_time_ms` :integer; `error_message` :string; `checked_at` :utc_datetime
- Índices/chaves: index [:provider, :entity_id]; index [:checked_at]

### `sub_merchants`
- Módulo: `Monetarie.Schemas.Settings.SubMerchant` (`core/backend/lib/monetarie/schemas/settings/sub_merchant.ex:15`)
- Propósito: Sublojistas cadastrados sob um lojista principal no backoffice administrativo, com documento e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `trading_name` :string; `document` :string; `status` :string (default: "active"); `entity_id` belongs_to `Entity`; `parent_merchant_id` belongs_to `User`
- Índices/chaves: unique [:entity_id, :document]; index [:entity_id, :parent_merchant_id]; index [:entity_id, :status]

### `system_settings`
- Módulo: `Monetarie.Schemas.Settings.SystemSetting` (`core/backend/lib/monetarie/schemas/settings/system_setting.ex:17`)
- Propósito: Configurações gerais do sistema em formato chave-valor, organizadas por seção, com tipo de dado e descrição.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `section` :string; `key` :string; `value` :string; `data_type` :string (default: "string"); `description` :string
- Índices/chaves: unique [section, key]

### `tenant_api_keys`
- Módulo: `Monetarie.Schemas.Tenants.ApiKey` (`core/backend/lib/monetarie/schemas/tenants/api_key.ex:34`)
- Propósito: Chaves de API por tenant (parceiro BaaS), com hash, escopos de acesso, limite de taxa e lista de IPs permitidos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `key_hash` :string; `key_prefix` :string; `name` :string; `scopes` {:array, :string} (default: []); `status` :string (default: "active"); `rate_limit` :integer (default: 1000); `last_used_at` :utc_datetime_usec; `expires_at` :utc_datetime_usec; `revoked_at` :utc_datetime_usec; `ip_whitelist` {:array, :string} (default: []); `metadata` :map (default: %{}); `tenant_id` belongs_to `Monetarie.Schemas.Tenants.Tenant`
- Índices/chaves: unique [key_hash]; index [key_prefix]; index [status]; index [tenant_id]; FK `tenant_id` → `tenants`

### `tenant_configs`
- Módulo: `Monetarie.Schemas.Tenants.TenantConfig` (`core/backend/lib/monetarie/schemas/tenants/tenant_config.ex:33`)
- Propósito: Configurações chave-valor específicas de cada tenant, instituição, na plataforma multi-tenant do Core.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `config_key` :string; `config_value` :string; `config_type` :string (default: "string"); `description` :string; `tenant_id` belongs_to `Monetarie.Schemas.Tenants.Tenant`
- Índices/chaves: unique [tenant_id, config_key]; index [tenant_id]; FK `tenant_id` → `tenants`

### `tenants`
- Módulo: `Monetarie.Schemas.Tenants.Tenant` (`core/backend/lib/monetarie/schemas/tenants/tenant.ex:31`)
- Propósito: Instituições clientes (tenants) da plataforma BaaS, com CNPJ, plano contratado, contato e status do contrato.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `slug` :string; `cnpj` :string; `status` :string (default: "active"); `plan_type` :string (default: "standard"); `contact_email` :string; `contact_phone` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [cnpj]; index [plan_type]; unique [slug]; index [status]

### `time_blocks`
- Módulo: `Monetarie.Schemas.Settings.TimeBlock` (`core/backend/lib/monetarie/schemas/settings/time_block.ex:17`)
- Propósito: Janelas de horário de bloqueio operacional configuradas no backoffice, por entidade, lojista, tipo de bloqueio e dias da semana.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `merchant_id` :integer; `name` :string; `start_time` :string; `end_time` :string; `days_of_week` {:array, :integer} (default: []); `block_type` :string (default: "pix_out"); `enabled` :boolean (default: true)
- Índices/chaves: index [:entity_id, :merchant_id]; index [:entity_id, :enabled]; index [:entity_id, :block_type]; index [:entity_id, :inserted_at]

### `tomadoras`
- Módulo: `Monetarie.Schemas.Tenants.Tomadora` (`core/backend/lib/monetarie/schemas/tenants/tomadora.ex:25`)
- Propósito: Instituições tomadoras que operam sob o guarda-chuva regulatório de uma instituição tenant maior, no modelo BaaS.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `cnpj` :string; `ispb` :string; `status` :string (default: "active"); `contact_email` :string; `metadata` :map (default: %{}); `tenant_id` belongs_to `Monetarie.Schemas.Tenants.Tenant`
- Índices/chaves: index [status]; unique [tenant_id, cnpj]; index [tenant_id]; FK `tenant_id` → `tenants`

### `white_label_configs`
- Módulo: `Monetarie.Schemas.Tenants.WhiteLabelConfig` (`core/backend/lib/monetarie/schemas/tenants/white_label_config.ex:33`)
- Propósito: Configuração de marca white-label por tenant (BaaS), com cores, logotipo, domínio próprio e e-mails de contato.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `brand_name` :string; `logo_url` :string; `favicon_url` :string; `primary_color` :string; `secondary_color` :string; `accent_color` :string; `custom_domain` :string; `email_from_name` :string; `email_from_address` :string; `support_email` :string; `support_phone` :string; `footer_text` :string; `custom_css` :string; `feature_flags` :map (default: %{}); `metadata` :map (default: %{}); `tenant_id` belongs_to `Monetarie.Schemas.Tenants.Tenant`
- Índices/chaves: unique [tenant_id]; FK `tenant_id` → `tenants`

## 9. Contabilidade COSIF e patrimônio

### `accounting_period_transitions`
- Módulo: `Monetarie.Schemas.Cosif.AccountingPeriodTransition` (`core/backend/lib/monetarie/schemas/cosif/accounting_period_transition.ex:27`)
- Propósito: Log de auditoria somente-inclusão das transições de status dos períodos contábeis, com sucesso, erro e responsável.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (updated_at: false, type: :utc_datetime)
- Colunas: `transition_type` Ecto.Enum; `from_status` :string; `to_status` :string; `success` :boolean (default: true); `error_message` :string; `error_details` :map; `reason` :string; `performed_by_name` :string; `metadata` :map (default: %{}); `period_id` belongs_to `AccountingPeriod`; `performed_by_id` belongs_to `PlatformAdmin`
- Índices/chaves: index [:period_id]; index [:period_id, :inserted_at]; index [:performed_by_id]

### `accounting_periods`
- Módulo: `Monetarie.Schemas.Cosif.AccountingPeriod` (`core/backend/lib/monetarie/schemas/cosif/accounting_period.ex:17`)
- Propósito: Períodos contábeis mensais abertos ou fechados, com balancete de verificação, total de provisionamento e protocolo de envio do CADOC 4010.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `year` :integer; `month` :integer; `status` Ecto.Enum; `opened_at` :utc_datetime; `closed_at` :utc_datetime; `closed_by_id` :integer; `trial_balance_total_debit` :integer; `trial_balance_total_credit` :integer; `trial_balance_difference` :integer; `provisioning_total` :integer; `cadoc_4010_submitted_at` :utc_datetime; `cadoc_4010_protocol` :string; `notes` :string
- Índices/chaves: unique [year, month]; FK `closed_by_id` → `users`

### `cosif_account_balances`
- Módulo: `Monetarie.Schemas.Cosif.CosifAccountBalance` (`core/backend/lib/monetarie/schemas/cosif/cosif_account_balance.ex:20`)
- Propósito: Snapshots de saldos contábeis das contas COSIF, com balancete, balanço patrimonial e código do ponto de atendimento por data-base.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `reference_date` :date; `trial_balance` :integer (default: 0); `balance_sheet` :integer (default: 0); `service_point_code` :string; `metadata` :map (default: %{}); `cosif_account_id` belongs_to `Monetarie.Schemas.Cosif.CosifAccount`
- Índices/chaves: unique [cosif_account_id, reference_date, service_point_code]; index [reference_date]; FK `cosif_account_id` → `cosif_accounts`

### `cosif_accounts`
- Módulo: `Monetarie.Schemas.Cosif.Account` (`core/backend/lib/monetarie/schemas/cosif/account.ex:18`), `Monetarie.Schemas.Cosif.CosifAccount` (`core/backend/lib/monetarie/schemas/cosif/cosif_account.ex:42`)
- Propósito: Plano de contas COSIF (Contabilidade das Instituições do Sistema Financeiro Nacional), com código, nível hierárquico e natureza da conta.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `level` :integer; `nature` :string (source: :category); `is_active` :boolean (default: true)
- Índices/chaves: unique [:alias]; index [:bacen_account]; index [:sped_account]; FK `entity_id` → `entities`

### `cosif_journal_entries`
- Módulo: `Monetarie.Schemas.Cosif.JournalEntry` (`core/backend/lib/monetarie/schemas/cosif/journal_entry.ex:34`)
- Propósito: Lançamentos contábeis no padrão COSIF, vinculados à transferência correspondente no ledger TigerBeetle, com referência de origem.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (updated_at: false); particionada por RANGE mensal (`cosif_journal_entries_partitioned`)
- Colunas: `entry_date` :date; `amount` :integer; `currency` :string (default: "BRL"); `description` :string; `reference_type` :string; `reference_id` :string; `tigerbeetle_transfer_id` :string; `metadata` :map (default: %{}); `debit_account_id` belongs_to `Monetarie.Schemas.Cosif.CosifAccount`; `credit_account_id` belongs_to `Monetarie.Schemas.Cosif.CosifAccount`; `created_by_admin_id` belongs_to `Monetarie.Schemas.Platform.Admin`
- Índices/chaves: index [:created_by_admin_id]; FK `credit_account_id` → `cosif_accounts`; FK `debit_account_id` → `cosif_accounts`; FK `entity_id` → `entities`

### `cosif_posting_templates`
- Módulo: `Monetarie.Schemas.Cosif.PostingTemplate` (`core/backend/lib/monetarie/schemas/cosif/posting_template.ex:29`)
- Propósito: Modelos de lançamento contábil COSIF por tipo de evento, com contas de débito e crédito e moeda.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `group` :string; `description` :string; `debit_cosif_code` :string; `credit_cosif_code` :string; `debit_account_type` :string; `credit_account_type` :string; `currency` :string (default: "BRL"); `requires_fx_conversion` :boolean (default: false); `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [event_type]; index ["group"]; index [is_active]

### `cost_allocations`
- Módulo: `Monetarie.Schemas.Cosif.CostAllocation` (`core/backend/lib/monetarie/schemas/cosif/cost_allocation.ex:8`)
- Propósito: Rateio de custos por competência (ano e mês) entre contas COSIF, com base de apropriação e tipo de alocação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `period_year` :integer; `period_month` :integer; `cosif_account` :string; `amount` :integer; `allocation_type` Ecto.Enum; `apportionment_basis` Ecto.Enum; `description` :string; `cost_center_id` belongs_to `Monetarie.Schemas.Cosif.CostCenter`
- Índices/chaves: index [cost_center_id]; index [period_year, period_month]; FK `cost_center_id` → `cost_centers`

### `cost_centers`
- Módulo: `Monetarie.Schemas.Cosif.CostCenter` (`core/backend/lib/monetarie/schemas/cosif/cost_center.ex:8`)
- Propósito: Centros de custo usados na contabilidade gerencial da instituição, com código, tipo e status de atividade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `center_type` Ecto.Enum; `active` :boolean (default: true); `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`; `parent_id` belongs_to `__MODULE__`
- Índices/chaves: unique [code]; FK `branch_id` → `branches`; FK `parent_id` → `cost_centers`

### `depreciation_entries`
- Módulo: `Monetarie.Schemas.Cosif.DepreciationEntry` (`core/backend/lib/monetarie/schemas/cosif/depreciation_entry.ex:8`)
- Propósito: Lançamentos mensais de depreciação de ativos, com valor depreciado, saldo acumulado e valor contábil líquido resultante.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `period_year` :integer; `period_month` :integer; `depreciation_amount` :integer; `accumulated_after` :integer; `net_book_value_after` :integer; `asset_id` belongs_to `Monetarie.Schemas.Cosif.FixedAsset`
- Índices/chaves: index [asset_id]; unique [asset_id, period_year, period_month]; FK `asset_id` → `fixed_assets`

### `fixed_assets`
- Módulo: `Monetarie.Schemas.Cosif.FixedAsset` (`core/backend/lib/monetarie/schemas/cosif/fixed_asset.ex:8`)
- Propósito: Ativo imobilizado da instituição, com valor de aquisição, método e valor de depreciação acumulada e conta COSIF vinculada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `asset_code` :string; `description` :string; `category` Ecto.Enum; `acquisition_date` :date; `acquisition_value` :integer; `residual_value` :integer (default: 0); `useful_life_months` :integer; `depreciation_method` :string (default: "linear"); `accumulated_depreciation` :integer (default: 0); `net_book_value` :integer; `cosif_account` :string; `status` Ecto.Enum; `disposed_at` :date; `disposal_value` :integer; `notes` :string; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: unique [asset_code]; index [branch_id]; index [category]; index [status]; FK `branch_id` → `branches`

### `non_use_assets`
- Módulo: `Monetarie.Schemas.Cosif.NonUseAsset` (`core/backend/lib/monetarie/schemas/cosif/non_use_asset.ex:8`)
- Propósito: Bens não de uso próprio recebidos em dação de pagamento de empréstimos, com prazo de alienação e conta COSIF vinculada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `description` :string; `category` Ecto.Enum; `received_date` :date; `received_value` :integer; `appraised_value` :integer; `disposal_deadline` :date; `status` Ecto.Enum; `disposed_at` :date; `disposal_value` :integer; `cosif_account` :string; `loan_id` Ecto.UUID; `notes` :string; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [disposal_deadline]; index [status]; FK `branch_id` → `branches`

### `results_calculations`
- Módulo: `ResultsCalculation` (`core/backend/lib/monetarie/schemas/cosif/results.ex:27`)
- Propósito: Apuração de resultado do exercício fiscal, com receitas, despesas, reservas legais, IRPJ e CSLL calculados e aprovados.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `fiscal_year` :integer; `status` Ecto.Enum; `total_revenue` :integer (default: 0); `total_expenses` :integer (default: 0); `gross_result` :integer (default: 0); `legal_reserve` :integer (default: 0); `other_reserves` :integer (default: 0); `irpj_amount` :integer (default: 0); `csll_amount` :integer (default: 0); `approved_by_id` :binary_id; `approved_at` :utc_datetime; `notes` :string; `period_id` belongs_to `Monetarie.Schemas.Cosif.AccountingPeriod`
- Índices/chaves: unique [:fiscal_year]; FK `approved_by_id` → `users`; FK `period_id` → `accounting_periods`

## 10. Crédito (empréstimos, consignado, desconto, provisão)

### `averbacoes`
- Módulo: `Monetarie.Schemas.Consignado.Averbacao` (`core/backend/lib/monetarie/schemas/consignado/averbacao.ex:18`)
- Propósito: Averbações de contratos de crédito consignado, com CPF, benefício, matrícula, parcelas, taxa de juros mensal e CET.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cpf` :string; `numero_beneficio` :string; `matricula_servidor` :string; `valor_contrato` :integer; `valor_parcela` :integer; `quantidade_parcelas` :integer; `parcelas_pagas` :integer (default: 0); `taxa_juros_mensal` :decimal; `cet_mensal` :decimal; `primeira_competencia` :date; `ultima_competencia` :date; `status` :string (default: "pendente"); `codigo_retorno_agente` :string; `mensagem_retorno` :string; `data_averbacao` :utc_datetime_usec; `data_desaverbacao` :utc_datetime_usec; `motivo_desaverbacao` :string; `eh_portabilidade` :boolean (default: false); `contrato_origem_id` :binary_id; `contrato_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `convenio_id` belongs_to `Monetarie.Schemas.Consignado.Convenio`; `cooperado_id` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [contrato_id]; index [convenio_id]; index [cpf]; index [status]; FK `contrato_id` → `loans`; FK `contrato_origem_id` → `loans`; FK `convenio_id` → `convenios`; FK `cooperado_id` → `users`

### `consignado_biometric_consents` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Consentimentos biométricos de operações de crédito consignado INSS registrados pelo BiometricConsentService.
- Colunas: `id` uuid NOT NULL; `cpf` character varying(11) NOT NULL; `liveness_score` double precision; `face_match_score` double precision; `evidence_hash` character varying(64) NOT NULL; `consent_data` jsonb DEFAULT '{}'::jsonb; `status` character varying(30) DEFAULT 'verified'::character varying NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [cpf]; index [inserted_at]; index [status]

### `consignors`
- Módulo: `Monetarie.Schemas.Credit.Consignor` (`core/backend/lib/monetarie/schemas/credit/consignor.ex:12`)
- Propósito: Entidade consignante de crédito com desconto em folha de pagamento (ente consignante), com razão social e documento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `legal_name` :string; `document` :string
- Índices/chaves: unique [:document]; index [:name]

### `convenios`
- Módulo: `Monetarie.Schemas.Consignado.Convenio` (`core/backend/lib/monetarie/schemas/consignado/convenio.ex:20`)
- Propósito: Convênios de crédito consignado firmados com entidades consignantes (INSS, SIAPE etc.), com margens e taxas máximas permitidas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `codigo_externo` :string; `nome_entidade` :string; `tipo_convenio` :string; `cnpj_entidade` :string; `percentual_margem_emprestimo` :decimal; `percentual_margem_cartao` :decimal; `prazo_maximo_meses` :integer; `taxa_maxima_mensal` :decimal; `plataforma_integracao` :string; `endpoint_api` :string; `credenciais_vault_key` :string; `formato_retorno` :string (default: "api_json"); `vigencia_inicio` :date; `vigencia_fim` :date; `status` :string (default: "ativo"); `motivo_suspensao` :string
- Índices/chaves: unique [codigo_externo]; index [status]; index [tipo_convenio]

### `credit_approval_tier_members`
- Módulo: `Monetarie.Schemas.Credit.ApprovalTierMember` (`core/backend/lib/monetarie/schemas/credit/approval_tier_member.ex:8`)
- Propósito: Associação de usuários aos níveis (alçadas) de aprovação de propostas de crédito.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `user_id` :string; `user_name` :string; `tier_id` belongs_to `Monetarie.Schemas.Credit.ApprovalTier`
- Índices/chaves: index [:tier_id]; unique [:tier_id, :user_id]

### `credit_approval_tiers`
- Módulo: `Monetarie.Schemas.Credit.ApprovalTier` (`core/backend/lib/monetarie/schemas/credit/approval_tier.ex:8`)
- Propósito: Faixas de alçada de aprovação de crédito por valor mínimo e máximo, com quórum mínimo exigido e prioridade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `description` :string; `min_amount` :integer (default: 0); `max_amount` :integer; `min_quorum` :integer (default: 1); `active` :boolean (default: true); `priority` :integer (default: 0); `loan_product_id` belongs_to `Monetarie.Schemas.Credit.LoanProduct`
- Índices/chaves: index [:loan_product_id]; index [:active]

### `discount_approvals`
- Módulo: `Monetarie.Schemas.Discount.DiscountApproval` (`core/backend/lib/monetarie/schemas/discount/discount_approval.ex:18`)
- Propósito: Registro de aprovação de um pedido de desconto de recebíveis, por nível de alçada, decisão e parecer do decisor.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `level` :integer; `decision` :string (default: "pending"); `decided_by` :binary_id; `decided_by_name` :string; `decided_at` :utc_datetime; `notes` :string; `request_id` belongs_to `DiscountRequest`
- Índices/chaves: index [decision]; index [request_id]; FK `request_id` → `discount_requests`

### `discount_backlist`
- Módulo: `Monetarie.Schemas.Discount.BacklistEntry` (`core/backend/lib/monetarie/schemas/discount/backlist_entry.ex:19`)
- Propósito: Lista de restrição de sacados ou cedentes para operações de desconto de recebíveis, com motivo e vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `document` :string; `entity_name` :string; `reason` :string (default: "default"); `source` :string (default: "internal"); `listed_date` :date; `expiry_date` :date; `active` :boolean (default: true); `listed_by` :binary_id; `notes` :string; `metadata` :map (default: %{})
- Índices/chaves: index [active]; unique [document) WHERE (active = true]; index [source]

### `discount_events`
- Módulo: `Monetarie.Schemas.Discount.DiscountEvent` (`core/backend/lib/monetarie/schemas/discount/discount_event.ex:26`)
- Propósito: Trilha de auditoria de eventos de desconto em operações de crédito, com mudança de status, valor e responsável.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `performed_by` :binary_id; `performed_by_name` :string; `old_status` :string; `new_status` :string; `amount` :integer; `details` :map (default: %{}); `notes` :string; `request_id` belongs_to `DiscountRequest`; `receivable_id` belongs_to `DiscountedReceivable`
- Índices/chaves: index [event_type]; index [inserted_at]; index [receivable_id]; index [request_id]; FK `receivable_id` → `discounted_receivables`; FK `request_id` → `discount_requests`

### `discount_limits`
- Módulo: `Monetarie.Schemas.Discount.DiscountLimit` (`core/backend/lib/monetarie/schemas/discount/discount_limit.ex:18`)
- Propósito: Limites de desconto de recebíveis aprovados para um cooperado ou cliente, com valor aprovado, uso corrente e aprovador.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `approved_limit` :integer; `current_usage` :integer (default: 0); `approved_by` :binary_id; `approved_at` :utc_datetime; `review_date` :date; `status` :string (default: "active"); `notes` :string; `metadata` :map (default: %{}); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `product_id` belongs_to `Monetarie.Schemas.Discount.DiscountProduct`
- Índices/chaves: index [member_id]; unique [member_id, product_id]; index [product_id]; index [status]; FK `member_id` → `cooperative_members`; FK `product_id` → `discount_products`

### `discount_products`
- Módulo: `Monetarie.Schemas.Discount.DiscountProduct` (`core/backend/lib/monetarie/schemas/discount/discount_product.ex:18`)
- Propósito: Configuração de produtos de desconto de recebíveis, com faixas de taxa, tarifa, prazo e valor de face permitidos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `receivable_types` {:array, :string} (default: []); `min_rate_bps` :integer; `max_rate_bps` :integer; `default_rate_bps` :integer; `fee_rate_bps` :integer (default: 0); `min_term_days` :integer (default: 1); `max_term_days` :integer; `min_face_value` :integer; `max_face_value` :integer; `max_capital_multiple` :integer (default: 0); `approval_levels` :map (default: %{}); `requires_guarantee` :boolean (default: false); `active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: index [active]; unique [code]

### `discount_requests`
- Módulo: `Monetarie.Schemas.Discount.DiscountRequest` (`core/backend/lib/monetarie/schemas/discount/discount_request.ex:23`)
- Propósito: Pedidos de desconto de recebíveis (duplicatas), com valor de face, deságio, IOF, taxa aplicada e taxa negociada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `total_face_value` :integer (default: 0); `total_discount` :integer (default: 0); `total_iof` :integer (default: 0); `total_fees` :integer (default: 0); `net_amount` :integer (default: 0); `applied_rate_bps` :integer; `negotiated_rate_bps` :integer; `status` :string (default: "draft"); `submitted_at` :utc_datetime; `analyzed_at` :utc_datetime; `approved_at` :utc_datetime; `rejected_at` :utc_datetime; `rejection_reason` :string; `disbursed_at` :utc_datetime; `settled_at` :utc_datetime; `contract_number` :string; `scr_operation_id` :binary_id; `scr_modality` :string (default: "0216"); `notes` :string; `metadata` :map (default: %{}); `product_id` belongs_to `DiscountProduct`; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [account_id]; index [branch_id]; unique [contract_number) WHERE (contract_number IS NOT NULL]; index [member_id]; index [product_id]; index [status]; FK `branch_id` → `branches`; FK `member_id` → `cooperative_members`; FK `product_id` → `discount_products`

### `discount_writeoffs`
- Módulo: `Monetarie.Schemas.Discount.DiscountWriteoff` (`core/backend/lib/monetarie/schemas/discount/discount_writeoff.ex:21`)
- Propósito: Registros de baixa de operações de desconto (write off), com valor baixado, motivo, nível de provisionamento e atualização no SCR.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `writeoff_date` :date; `writeoff_amount` :integer; `reason` :string; `approved_by` :binary_id; `approved_at` :utc_datetime; `provisioning_level` :string; `scr_updated` :boolean (default: false); `notes` :string; `metadata` :map (default: %{}); `receivable_id` belongs_to `DiscountedReceivable`; `custody_item_id` belongs_to `CustodyItem`
- Índices/chaves: index [custody_item_id]; index [receivable_id]; index [writeoff_date]; FK `custody_item_id` → `custody_items`; FK `receivable_id` → `discounted_receivables`

### `discounted_receivables`
- Módulo: `Monetarie.Schemas.Discount.DiscountedReceivable` (`core/backend/lib/monetarie/schemas/discount/discounted_receivable.ex:20`)
- Propósito: Recebíveis individuais, como duplicatas e cheques, descontados em uma operação, com valor de face, IOF, tarifa e valor líquido.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `receivable_type` :string; `document_number` :string; `drawer_name` :string; `drawer_document` :string; `face_value` :integer; `discount_amount` :integer (default: 0); `iof_amount` :integer (default: 0); `fee_amount` :integer (default: 0); `net_value` :integer (default: 0); `issue_date` :date; `maturity_date` :date; `settlement_date` :date; `presented_date` :date; `status` :string (default: "pending"); `days_to_maturity` :integer; `nfe_key` :string; `nfe_validated` :boolean (default: false); `nfe_validation_date` :utc_datetime; `converted_from_custody_id` :binary_id; `notes` :string; `metadata` :map (default: %{}); `request_id` belongs_to `DiscountRequest`
- Índices/chaves: index [drawer_document]; index [maturity_date]; index [receivable_type]; index [request_id]; index [status]; FK `request_id` → `discount_requests`

### `guarantee_type_codes`
- Módulo: `Monetarie.Schemas.Credit.GuaranteeTypeCode` (`core/backend/lib/monetarie/schemas/credit/guarantee_type_code.ex:6`)
- Propósito: Tabela de códigos de tipo de garantia do SCR do BACEN, indicando categoria, natureza fidejussória e piso de carteira.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`; timestamps (type: :utc_datetime)
- Colunas: `domain` :string; `subdomain` :string; `description` :string; `requires_identifier` :string; `guarantee_category` :string; `portfolio_floor` :string; `portfolio_floor_rank` :integer; `is_fidejussoria` :boolean; `is_active` :boolean
- Índices/chaves: unique [:domain, :subdomain]; index [:domain]; index [:is_fidejussoria]; index [:portfolio_floor_rank]

### `inss_benefit_blocks`
- Módulo: `Monetarie.Schemas.Consignado.InssBenefitBlock` (`core/backend/lib/monetarie/schemas/consignado/inss_benefit_block.ex:23`)
- Propósito: Registra bloqueios e desbloqueios de benefícios do INSS vinculados a empréstimo consignado, com motivo e evidência biométrica.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cpf` :string; `numero_beneficio` :string; `status` :string (default: "bloqueado"); `motivo_bloqueio` :string (default: "automatico_lei_15327"); `data_bloqueio` :utc_datetime_usec; `data_desbloqueio` :utc_datetime_usec; `desbloqueio_biometria_evidence` :map; `solicitado_por` :string
- Índices/chaves: index [cpf]; unique [numero_beneficio]; index [status]

### `loan_accruals`
- Módulo: `Monetarie.Schemas.Credit.LoanAccrual` (`core/backend/lib/monetarie/schemas/credit/loan_accrual.ex:8`)
- Propósito: Apropriação diária de juros de empréstimos, com saldo devedor, taxa anual em bps e valor acumulado no período.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `accrual_date` :date; `outstanding_balance` :integer; `annual_rate_bps` :integer; `accrued_amount` :integer; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: unique [:loan_id, :accrual_date]; index [:accrual_date]

### `loan_addendums`
- Módulo: `Monetarie.Schemas.Credit.LoanAddendum` (`core/backend/lib/monetarie/schemas/credit/loan_addendum.ex:15`)
- Propósito: Aditivo contratual de empréstimo que reagenda parcelas em aberto, registrando snapshot do saldo, atraso e novas condições pactuadas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `addendum_date` :date; `snapshot_outstanding_balance` :integer; `snapshot_open_installments` :integer; `snapshot_days_overdue` :integer (default: 0); `snapshot_risk_portfolio` :string; `partial_payment` :integer (default: 0); `new_balance` :integer; `new_installments_count` :integer; `new_initial_due_date` :date; `new_annual_rate_bps` :integer; `amortization_type` :string (default: "price"); `created_by_admin_id` :binary_id; `status` :string (default: "applied"); `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [:loan_id]; index [:addendum_date]

### `loan_amortization_schedules` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Cronogramas de amortização de contratos de crédito gerados na concessão (baseline, acesso via SQL).
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `loan_id` uuid NOT NULL; `version` integer DEFAULT 1 NOT NULL; `reason` character varying(255) DEFAULT 'original'::character varying NOT NULL; `method` character varying(255) NOT NULL; `principal` bigint NOT NULL; `monthly_rate_bps` integer NOT NULL; `term_months` integer NOT NULL; `first_due_date` date NOT NULL; `total_payment` bigint; `total_interest` bigint; `previous_version_id` uuid; `notes` text; `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [loan_id]; unique [loan_id, version]; FK `loan_id` → `loans`; FK `previous_version_id` → `loan_amortization_schedules`

### `loan_approvals`
- Módulo: `Monetarie.Schemas.Credit.LoanApproval` (`core/backend/lib/monetarie/schemas/credit/loan_approval.ex:19`)
- Propósito: Etapas da cadeia de aprovação de empréstimos por alçada, com nível, cargo exigido, decisão e responsável pela análise.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `level` :integer; `role_required` :string; `approved_by` :binary_id; `approved_by_name` :string; `decision` :string (default: "pending"); `notes` :string; `decided_at` :utc_datetime; `loan_id` belongs_to `Loan`
- Índices/chaves: index [loan_id]; unique [loan_id, level]; FK `loan_id` → `loans`

### `loan_collaterals`
- Módulo: `Monetarie.Schemas.Credit.LoanCollateral` (`core/backend/lib/monetarie/schemas/credit/loan_collateral.ex:8`)
- Propósito: Garantias vinculadas a contratos de empréstimo, com valor empenhado e percentual de cobertura da garantia.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `pledged_value` :integer (default: 0); `guarantee_percentage` :decimal; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `member_asset_id` belongs_to `Monetarie.Schemas.Cooperative.MemberAsset`
- Índices/chaves: index [:loan_id]; index [:member_asset_id]; unique [:loan_id, :member_asset_id]

### `loan_contract_snapshots`
- Módulo: `Monetarie.Schemas.Credit.LoanContractSnapshot` (`core/backend/lib/monetarie/schemas/credit/loan_contract_snapshot.ex:6`)
- Propósito: Fotografias periódicas do saldo de contratos de empréstimo, com valor contábil, multa, juros de mora e dias de atraso.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `contract_number` :string; `account_number` :string; `snapshot_date` :date; `snapshot_type` :integer; `balance` :integer (default: 0); `accounting_balance` :integer (default: 0); `present_value_balance` :integer (default: 0); `fine_amount` :integer (default: 0); `interest_arrears_amount` :integer (default: 0); `discount_amount` :integer (default: 0); `income_amount` :integer (default: 0); `overdue_days` :integer (default: 0); `overdue_installments` :integer (default: 0)
- Índices/chaves: index [:contract_number]; index [:snapshot_date]; unique [:contract_number, :snapshot_date, :snapshot_type]

### `loan_events`
- Módulo: `Monetarie.Schemas.Credit.LoanEvent` (`core/backend/lib/monetarie/schemas/credit/loan_event.ex:21`)
- Propósito: Trilha de auditoria de eventos ocorridos em um contrato de empréstimo, com tipo de evento, responsável e observações.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `data` :map (default: %{}); `performed_by` :binary_id; `performed_by_name` :string; `notes` :string; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [event_type]; index [inserted_at]; index [loan_id]; FK `loan_id` → `loans`

### `loan_guarantors`
- Módulo: `Monetarie.Schemas.Credit.LoanGuarantor` (`core/backend/lib/monetarie/schemas/credit/loan_guarantor.ex:8`)
- Propósito: Fiadores e avalistas de contratos de empréstimo, com datas de registro em SCPC, SPC e Serasa e vencimento da garantia.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `contract_number` :string; `account_number` :string; `guarantor_document` :string; `borrower_document` :string; `guarantee_date` :date; `operation_type` :integer; `guarantee_type` :integer; `scpc_date` :date; `spc_date` :date; `serasa_date` :date; `due_date` :date; `settlement_date` :date; `guarantee_type_code_id` belongs_to `GuaranteeTypeCode`
- Índices/chaves: index [:contract_number]; index [:guarantor_document]; unique [:contract_number, :guarantor_document]; index [:guarantee_type_code_id]

### `loan_installment_balance_history`
- Módulo: `Monetarie.Schemas.Credit.LoanInstallmentBalanceHistory` (`core/backend/lib/monetarie/schemas/credit/loan_installment_balance_history.ex:7`)
- Propósito: Histórico de saldo devedor por parcela de empréstimo, com snapshot por data de referência para fins contábeis e regulatórios.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `loan_id` :binary_id; `account` :string; `installment` :integer; `balance` :integer  # DB column is bigint; Ecto :integer reads it correctly via postgrex; `reference_date` :date; `snapshot_date` :date
- Índices/chaves: unique [:loan_id, :installment, :snapshot_date]; index [:snapshot_date]; index [:loan_id]

### `loan_installment_balances`
- Módulo: `Monetarie.Schemas.Credit.LoanInstallmentBalance` (`core/backend/lib/monetarie/schemas/credit/loan_installment_balance.ex:7`)
- Propósito: Saldo de cada parcela de empréstimo por data de referência, usado no controle de amortização do contrato.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account` :string; `installment` :integer; `balance` :integer  # DB column is bigint; Ecto :integer reads it correctly via postgrex; `reference_date` :date; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: unique [:loan_id, :installment]; index [:loan_id]; index [:reference_date]

### `loan_installment_snapshots`
- Módulo: `Monetarie.Schemas.Credit.LoanInstallmentSnapshot` (`core/backend/lib/monetarie/schemas/credit/loan_installment_snapshot.ex:6`)
- Propósito: Fotografias periódicas do saldo devedor por parcela de contrato de empréstimo, usadas na apuração contábil de desconto e receita.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `contract_number` :string; `account_number` :string; `snapshot_date` :date; `installment_number` :integer; `balance` :integer (default: 0); `discount_amount` :integer (default: 0); `income_amount` :integer (default: 0)
- Índices/chaves: index [:contract_number]; index [:snapshot_date]; unique [:contract_number, :installment_number, :snapshot_date]

### `loan_installments`
- Módulo: `Monetarie.Schemas.Credit.LoanInstallment` (`core/backend/lib/monetarie/schemas/credit/loan_installment.ex:19`)
- Propósito: Parcelas individuais de contratos de empréstimo, com vencimento, valores de principal, juros, IOF e status de pagamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `schedule_id` :binary_id; `number` :integer; `due_date` :date; `payment_amount` :integer; `principal_amount` :integer; `interest_amount` :integer; `iof_amount` :integer (default: 0); `balance_after` :integer; `status` :string (default: "pending"); `paid_amount` :integer (default: 0); `paid_date` :naive_datetime; `penalty_amount` :integer (default: 0); `overdue_days` :integer (default: 0); `metadata` :map (default: %{}); `loan_id` belongs_to `Loan`
- Índices/chaves: index [due_date]; index [loan_id]; index [schedule_id]; index [status]; FK `loan_id` → `loans`; FK `schedule_id` → `loan_amortization_schedules`

### `loan_movements`
- Módulo: `Monetarie.Schemas.Credit.LoanMovement` (`core/backend/lib/monetarie/schemas/credit/loan_movement.ex:10`)
- Propósito: Movimentações históricas de contas de empréstimo, com data, parcela, valor, histórico contábil e usuário responsável.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account` :string; `installment` :integer; `date` :date; `complement` :string; `loan_historic` :string; `value` :integer  # DB column is bigint; Ecto :integer reads it correctly via postgrex; `user_code` :string; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `product_id` belongs_to `Monetarie.Schemas.Credit.LoanProduct`
- Índices/chaves: index [:loan_id]; index [:loan_id, :installment]; index [:date]; index [:loan_historic]

### `loan_payments`
- Módulo: `Monetarie.Schemas.Credit.LoanPayment` (`core/backend/lib/monetarie/schemas/credit/loan_payment.ex:22`)
- Propósito: Pagamentos de empréstimos, com valores de principal, juros, multa e IOF pagos, método, status e possível reversão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `payment_date` :date; `amount` :integer; `principal_paid` :integer (default: 0); `interest_paid` :integer (default: 0); `penalty_paid` :integer (default: 0); `iof_paid` :integer (default: 0); `payment_method` :string; `reference` :string; `status` :string (default: "confirmed"); `reversed_at` :utc_datetime; `reversal_reason` :string; `processed_by` :binary_id; `metadata` :map (default: %{}); `loan_id` belongs_to `Loan`; `installment_id` belongs_to `LoanInstallment`
- Índices/chaves: index [installment_id]; index [loan_id]; index [payment_date]; index [status]; FK `loan_id` → `loans`

### `loan_problematic_asset_log`
- Módulo: `Monetarie.Schemas.Credit.LoanProblematicAssetLog` (`core/backend/lib/monetarie/schemas/credit/loan_problematic_asset_log.ex:7`)
- Propósito: Log de eventos de ativos problemáticos (inadimplência) de empréstimos, com dias de atraso e execução relacionada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `event_type` :string   # "entered" | "exited"; `event_date` :date; `days_overdue` :integer; `execution_id` :integer; `inserted_at` :utc_datetime; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [:loan_id]; index [:event_date]; index [:loan_id, :event_date]

### `loan_product_definitions` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Definições legadas de produtos de crédito do sistema anterior, substituídas pela tabela loan_products (baseline).
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `modality` character varying(255) NOT NULL; `name` character varying(255) NOT NULL; `description` text; `amortization_methods` character varying(255)[] DEFAULT ARRAY[]::character varying[] NOT NULL; `default_amortization` character varying(255) DEFAULT 'price'::character varying NOT NULL; `min_amount` bigint NOT NULL; `max_amount` bigint NOT NULL; `min_term_months` integer NOT NULL; `max_term_months` integer; `min_annual_rate_bps` integer NOT NULL; `max_annual_rate_bps` integer NOT NULL; `grace_period_months` integer DEFAULT 0 NOT NULL; `grace_type` character varying(255) DEFAULT 'none'::character varying NOT NULL; `iof_exempt` boolean DEFAULT false NOT NULL; `admin_fee_bps` integer DEFAULT 0 NOT NULL; `insurance_fee_bps` integer DEFAULT 0 NOT NULL; `multa_rate_bps` integer DEFAULT 200 NOT NULL; `mora_rate_bps` integer DEFAULT 100 NOT NULL; `requires_guarantee` boolean DEFAULT false NOT NULL; `guarantee_types` character varying(255)[] DEFAULT ARRAY[]::character varying[]; `auto_approve_up_to` bigint DEFAULT 0 NOT NULL; `regulatory_code` character varying(255); `active` boolean DEFAULT true NOT NULL; `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [active]; index [modality]

### `loan_products`
- Módulo: `Monetarie.Schemas.Credit.LoanProduct` (`core/backend/lib/monetarie/schemas/credit/loan_product.ex:31`)
- Propósito: Configuração de produtos de crédito, com modalidade, tipo de amortização e juros, taxa mínima e máxima anual e público-alvo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `model_type` :string (default: "normal"); `modality_code` :string; `amortization_type` :string (default: "price"); `interest_type` :string (default: "PRE"); `dias_vencimento` :integer; `pessoa_tipo` :string; `parent_product_id` :binary_id; `min_annual_rate_bps` :integer; `max_annual_rate_bps` :integer; `min_term_months` :integer (default: 1); `max_term_months` :integer; `min_amount` :integer; `max_amount` :integer; `max_capital_multiple` :integer (default: 0); `requires_guarantee` :boolean (default: false); `guarantee_types` {:array, :string} (default: []); `auto_approve_up_to` :integer (default: 0); `approval_levels` :map (default: %{}); `admin_fee_bps` :integer (default: 0); `insurance_fee_bps` :integer (default: 0); `iof_exempt` :boolean (default: false); `multa_rate_bps` :integer (default: 200); `mora_rate_bps` :integer (default: 100); `cosif_account` :string; `nature_code` :string (default: "01"); `resource_origin` :string (default: "0199"); `active` :boolean (default: true); `inactivated_at` :utc_datetime; `contract_template` :string; `metadata` :map (default: %{}); `inactivated_by_id` belongs_to `Monetarie.Schemas.Platform.Admin`
- Índices/chaves: index [active]; unique [code]; index [modality_code]

### `loan_products_historic`
- Módulo: `Monetarie.Schemas.Credit.LoanProductsHistoric` (`core/backend/lib/monetarie/schemas/credit/loan_products_historic.ex:25`)
- Propósito: Configuração histórica de contas contábeis de produtos de crédito, para liberação, tarifas, encargos, multa e provisão incorrida.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `principal_account` :string; `liberation` :string; `fees` :string; `liquidation` :string; `we_add` :string; `discount` :string; `fine` :string; `fees_delay` :string; `fees_ap` :string; `we_add_ap` :string; `discount_ap` :string; `provision_incorrida` :string; `provision_adicional` :string; `provision_esperada` :string; `despesa_provisao` :string; `liberation_credit` :string; `liquidation_debit` :string; `discount_debit` :string; `fees_debit` :string; `fees_credit` :string; `fine_debit` :string; `fine_credit` :string; `fees_delay_debit` :string; `fees_delay_credit` :string; `we_add_debit` :string; `we_add_credit` :string; `fees_ap_debit` :string; `fees_ap_credit` :string; `we_add_ap_debit` :string; `we_add_ap_credit` :string; `discount_ap_debit` :string; `discount_ap_credit` :string; `provision_incorrida_debit` :string; `provision_incorrida_credit` :string; `provision_adicional_debit` :string; `provision_adicional_credit` :string; `provision_esperada_debit` :string; `provision_esperada_credit` :string; `despesa_provisao_debit` :string; `despesa_provisao_credit` :string; `product_id` belongs_to `Monetarie.Schemas.Credit.LoanProduct`
- Índices/chaves: unique [:product_id]

### `loan_proposal_approvals`
- Módulo: `Monetarie.Schemas.Credit.LoanProposalApproval` (`core/backend/lib/monetarie/schemas/credit/loan_proposal_approval.ex:6`)
- Propósito: Pareceres de aprovação de propostas de crédito por alçada, com decisão, origem, data e horário do parecer.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `proposal_id` :string; `user_code` :string; `approval_tier` :integer; `min_defer_tier` :integer; `max_reject_tier` :integer; `opinion_date` :date; `approved` :boolean; `opinion` :string; `origin` :integer; `notified` :boolean (default: false); `system_date` :date; `system_time` :string
- Índices/chaves: index [:proposal_id]; unique [:proposal_id, :user_code, :opinion_date]

### `loan_provisions` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Provisões para perdas por contrato de crédito calculadas pelo motor de provisionamento (baseline).
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `loan_id` uuid NOT NULL; `risk_level` character varying(255) NOT NULL; `provision_pct` integer NOT NULL; `outstanding_balance` bigint NOT NULL; `provision_amount` bigint NOT NULL; `days_overdue` integer NOT NULL; `calculated_at` timestamp without time zone NOT NULL; `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [calculated_at]; index [loan_id]; index [risk_level]; FK `loan_id` → `loans`

### `loan_recoveries` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Recuperações de créditos baixados a prejuízo (pagamentos posteriores ao write-off) do baseline.
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `loan_id` uuid NOT NULL; `write_off_date` date NOT NULL; `written_off_amount` bigint NOT NULL; `recovery_date` date NOT NULL; `recovery_amount` bigint NOT NULL; `recovery_source` character varying(255); `cumulative_recovered` bigint DEFAULT 0 NOT NULL; `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [loan_id]; index [recovery_date]; FK `loan_id` → `loans`

### `loan_renegotiations`
- Módulo: `Monetarie.Schemas.Credit.LoanRenegotiation` (`core/backend/lib/monetarie/schemas/credit/loan_renegotiation.ex:8`)
- Propósito: Renegociações de contratos de empréstimo, preservando dados do contrato original e saldo devedor ou vencido antes da renegociação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `renegotiation_type` :string; `renegotiated_at` :utc_datetime; `renegotiated_by_admin_id` :binary_id; `reason` :string; `original_contract_number` :string; `original_approved_amount` :integer; `original_annual_rate_bps` :integer; `original_term_months` :integer; `original_disbursement_date` :date; `original_maturity_date` :date; `outstanding_balance` :integer; `overdue_amount` :integer; `overdue_days` :integer; `total_paid` :integer; `open_installments_count` :integer; `paid_installments_count` :integer; `total_installments_count` :integer; `risk_rating` :string; `provision_amount` :integer; `new_contract_number` :string; `new_approved_amount` :integer; `new_annual_rate_bps` :integer; `new_term_months` :integer; `original_loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `new_loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [:original_loan_id]; index [:new_loan_id]; index [:renegotiated_at]

### `loan_risk_classifications`
- Módulo: `Monetarie.Schemas.Credit.Risk.RiskClassification` (`core/backend/lib/monetarie/schemas/credit/risk/risk_classification.ex:19`)
- Propósito: Classificação de risco (rating) de operações de crédito conforme regras do BACEN, com dias de atraso, provisão e justificativa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `previous_rating` :string; `new_rating` :string; `source` :string (default: "automatic"); `justification` :string; `status` :string (default: "applied"); `overdue_days` :integer (default: 0); `outstanding_balance` :integer (default: 0); `provision_rate` :decimal; `provision_amount` :integer (default: 0); `approved_at` :utc_datetime; `metadata` :map (default: %{}); `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `performed_by` belongs_to `Monetarie.Schemas.Platform.Admin`; `approved_by` belongs_to `Monetarie.Schemas.Platform.Admin`
- Índices/chaves: index [:loan_id]; index [:status]; index [:new_rating]; index [:inserted_at]

### `loan_simulations`
- Módulo: `Monetarie.Schemas.Credit.LoanSimulation` (`core/backend/lib/monetarie/schemas/credit/loan_simulation.ex:35`)
- Propósito: Simulações informativas de empréstimo, pré-proposta, com valor solicitado, prazo, taxa, tipo de garantia e validade da simulação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `operator_name` :string; `requested_amount` :integer; `term_months` :integer; `annual_rate_bps` :integer; `amortization_type` :string; `guarantee_type` :string; `guarantee_description` :string; `guarantee_value` :integer (default: 0); `purpose` :string; `notes` :string; `status` :string (default: "open"); `valid_until` :date; `converted_at` :utc_datetime; `cancelled_at` :utc_datetime; `cancelled_reason` :string; `simulation_number` :string; `metadata` :map (default: %{}); `loan_product_id` belongs_to `LoanProduct`; `member_id` belongs_to `Member`; `branch_id` belongs_to `Branch`; `operator_id` belongs_to `PlatformAdmin`; `converted_loan_id` belongs_to `Loan`
- Índices/chaves: unique [:simulation_number]; index [:member_id]; index [:operator_id]; index [:loan_product_id]; index [:converted_loan_id]; index [:status, :valid_until]

### `loan_status_history` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Histórico de mudanças de status de contratos de crédito (baseline).
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `loan_id` uuid NOT NULL; `from_status` character varying(255); `to_status` character varying(255) NOT NULL; `action` character varying(255) NOT NULL; `actor_id` uuid; `actor_name` character varying(255); `notes` text; `data` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [inserted_at]; index [loan_id]; index [to_status]; FK `loan_id` → `loans`

### `loans`
- Módulo: `Monetarie.Schemas.Credit.Loan` (`core/backend/lib/monetarie/schemas/credit/loan.ex:26`)
- Propósito: Contratos de empréstimo ou financiamento da cooperativa, com datas de aprovação, desembolso e vencimento, taxa e saldo devedor.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `contract_number` :string; `application_date` :date; `approval_date` :date; `disbursement_date` :date; `maturity_date` :date; `requested_amount` :integer; `approved_amount` :integer; `disbursed_amount` :integer; `annual_rate_bps` :integer; `term_months` :integer; `amortization_type` :string; `outstanding_balance` :integer (default: 0); `total_paid` :integer (default: 0); `overdue_amount` :integer (default: 0); `overdue_days` :integer (default: 0); `remaining_principal` :integer (default: 0); `admin_fee` :integer (default: 0); `insurance_fee` :integer (default: 0); `iof_amount` :integer (default: 0); `total_cost` :integer (default: 0); `guarantee_type` :string; `guarantee_description` :string; `guarantee_value` :integer (default: 0); `status` :string (default: "draft"); `rejection_reason` :string; `requested_by` :binary_id; `analyzed_by` :binary_id; `credit_score` :integer; `analysis_notes` :string; `scr_operation_id` :binary_id; `operation_type` :string (default: "cooperative"); `current_rating` :string (default: "A"); `rating_updated_at` :utc_datetime; `ecl_stage` :integer; `ecl_amount` :integer (default: 0); `ead_amount` :integer (default: 0); `pd_rate_bps` :integer; `lgd_rate_bps` :integer; `stage_changed_at` :utc_datetime; `last_accrual_date` :date; `ipoc` :string; `is_problematic_asset` :boolean (default: false); `metadata` :map (default: %{}); `loan_product_id` belongs_to `LoanProduct`; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [:current_rating]; index [:ipoc]; FK `branch_id` → `branches`; FK `loan_product_id` → `loan_products`; FK `member_id` → `cooperative_members`; FK `scr_operation_id` → `scr_credit_operations`

### `margem_reservas`
- Módulo: `Monetarie.Schemas.Consignado.MargemReserva` (`core/backend/lib/monetarie/schemas/consignado/margem_reserva.ex:19`)
- Propósito: Reserva temporária de margem consignável por CPF, com valor reservado, tipo de público e prazo de expiração.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cpf` :string; `tipo_publico` :string; `valor_reservado` :integer; `ttl_vencimento` :utc_datetime_usec; `status` :string (default: "ativa"); `contrato_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [cpf, status]; FK `contrato_id` → `loans`

### `parcelas_consignado`
- Módulo: `Monetarie.Schemas.Consignado.ParcelaConsignado` (`core/backend/lib/monetarie/schemas/consignado/parcela_consignado.ex:17`)
- Propósito: Controle individual de parcelas do crédito consignado, com juros, amortização, saldo devedor e código de retorno da consignação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `numero_parcela` :integer; `competencia` :date; `valor_parcela` :integer; `valor_juros` :integer; `valor_amortizacao` :integer; `saldo_devedor_apos` :integer; `status` :string (default: "aguardando"); `data_consignacao` :date; `data_recebimento` :date; `codigo_retorno` :string; `descricao_retorno` :string; `averbacao_id` belongs_to `Monetarie.Schemas.Consignado.Averbacao`; `contrato_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `repasse_id` belongs_to `Monetarie.Schemas.Consignado.Repasse`
- Índices/chaves: unique [averbacao_id, numero_parcela]; FK `averbacao_id` → `averbacoes`; FK `contrato_id` → `loans`; FK `repasse_id` → `repasses_consignado`

### `payroll_batch_items`
- Módulo: `Monetarie.Schemas.Credit.Payroll.BatchItem` (`core/backend/lib/monetarie/schemas/credit/payroll/batch_item.ex:16`)
- Propósito: Itens individuais de um lote de importação de folha de pagamento consignável, com matrícula, CPF, valor e status do processamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `matricula` :string; `cpf` :string; `name` :string; `amount` :integer; `event_code` :string; `loan_number` :integer; `raw_data` :map; `member_id` :binary_id; `account_id` :integer; `loan_id` :binary_id; `status` :string (default: "pending"); `error_message` :string; `account_entry_id` :binary_id; `loan_payment_id` :binary_id; `capital_share_id` :binary_id; `batch_id` belongs_to `Monetarie.Schemas.Credit.Payroll.Batch`
- Índices/chaves: index [:batch_id]; index [:status]; index [:cpf]

### `payroll_batches`
- Módulo: `Monetarie.Schemas.Credit.Payroll.Batch` (`core/backend/lib/monetarie/schemas/credit/payroll/batch.ex:27`)
- Propósito: Lotes de importação de descontos em folha de pagamento (consignado), com origem, mês de referência e valores processados.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `source` :string; `reference_month` :integer; `reference_year` :integer; `rubric_type` :string; `status` :string (default: "imported"); `file_name` :string; `file_hash` :string; `file_size` :integer; `total_items` :integer (default: 0); `total_amount` :integer (default: 0); `processed_items` :integer (default: 0); `processed_amount` :integer (default: 0); `error_items` :integer (default: 0); `processed_at` :utc_datetime; `processed_by` :binary_id; `uploaded_by` :binary_id; `employer_id` belongs_to `Monetarie.Schemas.Credit.Payroll.Employer`
- Índices/chaves: unique [:file_hash]; unique [:source, :reference_year, :reference_month, :rubric_type]; index [:status]; index [:employer_id]

### `payroll_employers`
- Módulo: `Monetarie.Schemas.Credit.Payroll.Employer` (`core/backend/lib/monetarie/schemas/credit/payroll/employer.ex:21`)
- Propósito: Empregadores de folha de pagamento conveniados para desconto de crédito consignado, com dias de corte e vencimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `cnpj` :string; `name` :string; `short_name` :string; `source_key` :string; `status` :string (default: "active"); `cut_day` :integer (default: 0); `due_day` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: unique [:cnpj]; unique [:source_key]; unique [:code]

### `portabilidades`
- Módulo: `Monetarie.Schemas.Portabilidade.Portabilidade` (`core/backend/lib/monetarie/schemas/portabilidade/portabilidade.ex:18`)
- Propósito: Solicitações de portabilidade de operação de crédito entre instituições, conforme CMN 5.057, com taxas e prazos do cedente e proponente.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tipo` :string; `cpf_tomador` :string; `cnpj_cedente` :string; `cnpj_proponente` :string; `numero_contrato_cedente` :string; `saldo_devedor` :integer; `taxa_cedente` :decimal; `taxa_proponente` :decimal; `prazo_remanescente` :integer; `prazo_novo` :integer; `valor_parcela_cedente` :integer; `valor_parcela_proponente` :integer; `valor_troco` :integer; `status` :string (default: "solicitada"); `nuclea_protocolo` :string; `motivo_recusa` :string; `contraproposta_taxa` :decimal; `contraproposta_prazo` :integer; `data_solicitacao` :utc_datetime_usec; `data_resposta_cedente` :utc_datetime_usec; `data_transferencia` :utc_datetime_usec; `data_efetivacao` :utc_datetime_usec; `prazo_resposta_cedente` :utc_datetime_usec; `contrato_cedente_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `contrato_proponente_id` belongs_to `Monetarie.Schemas.Credit.Loan`
- Índices/chaves: index [cnpj_cedente]; index [cnpj_proponente]; index [cpf_tomador]; index [status]; FK `contrato_cedente_id` → `loans`; FK `contrato_proponente_id` → `loans`

### `ppearc_history`
- Módulo: `Monetarie.Schemas.Credit.PpearcHistory` (`core/backend/lib/monetarie/schemas/credit/ppearc_history.ex:7`)
- Propósito: Histórico do cálculo de PPEARC, perda esperada de crédito (Resolução 4966), com PD, LGD, EAD e classificação de ativo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime, updated_at: false)
- Colunas: `credit_operation_id` :binary_id; `reference_date` :date; `carteira` :string; `estagio` :integer; `days_overdue` :integer (default: 0); `pd` :decimal; `lgd` :decimal; `ead_cents` :integer; `ppearc_amount_cents` :integer; `minimum_floor_cents` :integer; `final_provision_cents` :integer; `asset_classification` :string; `stop_accrual` :boolean (default: false); `calculation_method` :string; `metadata` :map (default: %{})

### `provision_entries`
- Módulo: `Monetarie.Schemas.Credit.Provisioning.ProvisionEntry` (`core/backend/lib/monetarie/schemas/credit/provisioning/provision_entry.ex:18`)
- Propósito: Lançamentos de cálculo de provisão para créditos de liquidação duvidosa, com nível de risco, saldo devedor e valor provisionado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_date` :date; `previous_level` :string; `new_level` :string; `stage` :integer; `previous_stage` :integer; `carteira` :string; `outstanding_balance` :decimal; `provision_rate` :decimal; `provision_amount` :decimal; `previous_provision` :decimal; `delta` :decimal; `metadata` :map (default: %{}); `credit_operation_id` belongs_to `Monetarie.Schemas.Regulatory.Scr.CreditOperation`
- Índices/chaves: index [carteira]; index [credit_operation_id]; unique [credit_operation_id, reference_date]; index [reference_date]; index [stage]; FK `credit_operation_id` → `scr_credit_operations`

### `provision_rules`
- Módulo: `Monetarie.Schemas.Credit.Provisioning.ProvisionRule` (`core/backend/lib/monetarie/schemas/credit/provisioning/provision_rule.ex:20`)
- Propósito: Regras de provisionamento de crédito por estágio, carteira e faixa de dias de atraso, conforme a Resolução CMN 4.966/2021.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `level` :string; `stage` :integer; `carteira` :string; `min_overdue_days` :integer (default: 0); `max_overdue_days` :integer; `provision_rate` :decimal; `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [stage, carteira, min_overdue_days]

### `repasses_consignado`
- Módulo: `Monetarie.Schemas.Consignado.Repasse` (`core/backend/lib/monetarie/schemas/consignado/repasse.ex:18`)
- Propósito: Acompanhamento mensal dos repasses de crédito consignado recebidos das entidades consignantes, com valor esperado, recebido e vencimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `competencia` :date; `valor_esperado` :integer; `valor_recebido` :integer; `quantidade_contratos` :integer; `tipo_repasse` :string; `numero_documento` :string; `data_vencimento` :date; `data_pagamento` :date; `status` :string (default: "pendente"); `arquivo_retorno_id` :binary_id; `convenio_id` belongs_to `Monetarie.Schemas.Consignado.Convenio`
- Índices/chaves: unique [convenio_id, competencia]; index [status]; FK `convenio_id` → `convenios`

### `risk_classification_execution`
- Módulo: `Monetarie.Schemas.Credit.RiskClassificationExecution` (`core/backend/lib/monetarie/schemas/credit/risk_classification_execution.ex:6`)
- Propósito: Execuções do job de classificação de risco de crédito por período de referência, com status, quantidade de contratos e erros.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`
- Colunas: `reference_date` :date; `started_at` :naive_datetime; `finished_at` :naive_datetime; `status` :string; `contracts_count` :integer; `error_message` :string; `created_by` :integer

### `risk_classification_result`
- Módulo: `Monetarie.Schemas.Credit.RiskClassificationResult` (`core/backend/lib/monetarie/schemas/credit/risk_classification_result.ex:7`)
- Propósito: Resultado da classificação de risco de crédito por contrato e cliente, com rating, dias de atraso e conta COSIF.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `reference_date` :date; `contract_id` :binary_id; `customer_id` :binary_id; `portfolio` :string; `risk_level_id` :integer; `is_problematic_asset` :boolean; `is_performing` :boolean; `days_overdue` :integer; `outstanding_balance` :decimal; `customer_score` :integer; `customer_rating` :string; `cosif_account` :string; `cosif_account_cp` :string; `history_code` :integer; `loss_rate` :decimal; `additional_rate` :decimal; `provision_amount` :decimal; `classification_reason` :string; `created_by` :integer; `execution_id` :integer; `created_at` :naive_datetime; `portfolio_overridden_by` :integer; `portfolio_overridden_at` :naive_datetime; `previous_portfolio` :string; `guarantee_domain` :string; `guarantee_subdomain` :string; `guarantee_type_code_id` :integer
- Índices/chaves: index [:guarantee_domain, :guarantee_subdomain]; index [:guarantee_type_code_id]

### `risk_level`
- Módulo: `Monetarie.Schemas.Credit.RiskLevel` (`core/backend/lib/monetarie/schemas/credit/risk_level.ex:6`)
- Propósito: Níveis de risco de crédito por carteira e faixa de dias de atraso, com conta COSIF, taxa de perda e adicional.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`
- Colunas: `portfolio` :string; `description` :string; `start_day` :integer; `end_day` :integer; `cosif_account` :string; `cosif_account_cp` :string; `is_problematic_asset` :boolean; `is_performing` :boolean; `loss_rate` :decimal; `additional_rate` :decimal; `created_by` :integer; `created_at` :naive_datetime

### `risk_portfolio_rule` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260509130000_create_risk_classification_4966.exs`
- Propósito: Regras de classificação de risco de carteira do motor de risco de crédito (migration SQL crua).
- Colunas: `id` SERIAL        PRIMARY KEY; `portfolio` VARCHAR(2)    NOT NULL UNIQUE; `score_min` INT           NOT NULL; `score_max` INT           NOT NULL; `description` VARCHAR(100)  NOT NULL; `is_active` BOOLEAN       NOT NULL DEFAULT TRUE; `created_at` TIMESTAMP     NOT NULL DEFAULT CURRENT_TIMESTAMP

## 11. Investimentos, captação e títulos

### `bma_fund_registrations`
- Módulo: `Monetarie.Schemas.BMA.FundRegistration` (`core/backend/lib/monetarie/schemas/bma/fund_registration.ex:29`)
- Propósito: Cadastro de fundos de investimento com CNPJ, administrador, gestor, código ANBIMA e CVM; descontinuada, pendente de reaproveitamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `fund_cnpj` :string; `fund_name` :string; `short_name` :string; `administrator_ispb` :string; `administrator_name` :string; `manager_cnpj` :string; `manager_name` :string; `fund_type` :string; `anbima_code` :string; `anbima_category` :string; `cvm_code` :string; `status` :string (default: "ACTIVE"); `inception_date` :date; `liquidation_date` :date; `metadata` :map (default: %{})
- Índices/chaves: index [administrator_ispb]; unique [anbima_code]; unique [fund_cnpj]; index [fund_type]; index [status]

### `bma_market_data`
- Módulo: `Monetarie.Schemas.BMA.MarketData` (`core/backend/lib/monetarie/schemas/bma/market_data.ex:26`)
- Propósito: Cotações e volumes de instrumentos financeiros vindos de B3, ANBIMA, BCB e CVM, módulo obsoleto mantido para reaproveitamento futuro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `instrument_code` :string; `instrument_name` :string; `price` :integer; `open_price` :integer; `high_price` :integer; `low_price` :integer; `close_price` :integer; `volume` :integer (default: 0); `trade_count` :integer (default: 0); `date` :date; `source` :string; `metadata` :map (default: %{})
- Índices/chaves: index [date]; unique [instrument_code, date, source]; index [instrument_code]; index [source]

### `cdi_rates`
- Módulo: `Monetarie.Schemas.Investments.CdiRate` (`core/backend/lib/monetarie/schemas/investments/cdi_rate.ex:7`)
- Propósito: Taxas diárias e anuais do CDI (Certificado de Depósito Interbancário) usadas para cálculo de rendimento de investimentos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `date` :date; `annual_rate_bps` :integer; `daily_rate_bps` :integer; `source` :string (default: "bacen_api")
- Índices/chaves: unique [date]

### `clearing_batch_items`
- Módulo: `Monetarie.Schemas.Custody.ClearingBatchItem` (`core/backend/lib/monetarie/schemas/custody/clearing_batch_item.ex:20`)
- Propósito: Itens de um lote de compensação (clearing), com status individual do item e motivo de rejeição, quando aplicável.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `item_status` :string (default: "pending"); `rejection_reason` :string; `batch_id` belongs_to `ClearingBatch`; `custody_item_id` belongs_to `CustodyItem`
- Índices/chaves: index [batch_id]; index [custody_item_id]; FK `batch_id` → `clearing_batches`; FK `custody_item_id` → `custody_items`

### `clearing_batches`
- Módulo: `Monetarie.Schemas.Custody.ClearingBatch` (`core/backend/lib/monetarie/schemas/custody/clearing_batch.ex:21`)
- Propósito: Lotes de compensação de operações, com número, tipo, valor total, arquivo enviado, resposta recebida e datas de confirmação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `batch_date` :date; `batch_type` :string; `batch_number` :integer; `total_items` :integer (default: 0); `total_value` :integer (default: 0); `status` :string (default: "draft"); `file_content` :string; `response_content` :string; `generated_at` :utc_datetime; `sent_at` :utc_datetime; `confirmed_at` :utc_datetime; `generated_by` :binary_id; `notes` :string; `metadata` :map (default: %{})
- Índices/chaves: index [batch_date]; index [batch_type]; index [status]

### `cor_broker_orders`
- Módulo: `Monetarie.Schemas.COR.BrokerOrder` (`core/backend/lib/monetarie/schemas/cor/broker_order.ex:21`)
- Propósito: Ordem de compra ou venda de valores mobiliários roteada por corretora no mercado de capitais, com preço e execução em centavos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `order_type` :string; `instrument_code` :string; `quantity` :integer; `price` :integer; `executed_quantity` :integer (default: 0); `executed_price` :integer (default: 0); `broker_ispb` :string; `client_document` :string; `status` :string (default: "PENDING"); `order_reference` :string; `exchange_order_id` :string; `submitted_at` :utc_datetime_usec; `executed_at` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [broker_ispb]; index [instrument_code]; index [instrument_code, status]; unique [order_reference]; index [order_type]; index [status]

### `cor_confirmations`
- Módulo: `Monetarie.Schemas.COR.Confirmation` (`core/backend/lib/monetarie/schemas/cor/confirmation.ex:20`)
- Propósito: Confirmações de negociação da bolsa ou câmara de compensação para ordens de corretora, com quantidade, preço e liquidação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `order_id` :binary_id; `confirmed_quantity` :integer; `confirmed_price` :integer; `counterparty_ispb` :string; `counterparty_name` :string; `trade_date` :date; `settlement_date` :date; `exchange_trade_id` :string; `status` :string (default: "PENDING"); `metadata` :map (default: %{})
- Índices/chaves: index [counterparty_ispb]; index [order_id]; index [status]; index [trade_date]; FK `order_id` → `cor_broker_orders`

### `coupon_schedules`
- Módulo: `Monetarie.Schemas.Investments.CouponSchedule` (`core/backend/lib/monetarie/schemas/investments/coupon_schedule.ex:18`)
- Propósito: Cronograma de pagamento de cupons de instrumento de renda fixa, com data, número do cupom e taxa em pontos base.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `coupon_number` :integer; `coupon_date` :date; `rate_bps` :integer; `scheduled_balance` :integer; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`; `rf_instrument_id` belongs_to `Monetarie.Schemas.Investments.RfInstrument`
- Índices/chaves: unique [:institution_id, :rf_instrument_id, :coupon_number]; index [:institution_id, :coupon_date]

### `csd_parameters`
- Módulo: `Monetarie.Schemas.CSD.Parameter` (`core/backend/lib/monetarie/schemas/csd/parameter.ex:15`)
- Propósito: Parâmetros configuráveis de sistemas do SFN (Sistema Financeiro Nacional) com vigência temporal, usados para consulta histórica e auditoria.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `param_key` :string; `param_value` :string; `description` :string; `system_code` :string; `effective_date` :date; `expiration_date` :date; `metadata` :map (default: %{})
- Índices/chaves: index [param_key]; unique [param_key, system_code, effective_date]; index [system_code]

### `csd_participants`
- Módulo: `Monetarie.Schemas.CSD.Participant` (`core/backend/lib/monetarie/schemas/csd/participant.ex:21`)
- Propósito: Cadastro de instituições financeiras participantes do SFN, como bancos, cooperativas e IPs, com ISPB, tipo, CNPJ e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `ispb` :string; `name` :string; `short_name` :string; `type` :string; `cnpj` :string; `status` :string (default: "ACTIVE"); `registration_date` :date; `cancellation_date` :date; `contact_email` :string; `contact_phone` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [cnpj]; unique [ispb]; index [name]; index [status]; index [type]

### `csd_system_enrollments`
- Módulo: `Monetarie.Schemas.CSD.SystemEnrollment` (`core/backend/lib/monetarie/schemas/csd/system_enrollment.ex:18`)
- Propósito: Registra a habilitação de participantes em sistemas de Central Depositária de Ativos (CSD), com data e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `participant_id` :binary_id; `system_code` :string; `enrollment_date` :date; `deactivation_date` :date; `status` :string (default: "PENDING"); `enrollment_type` :string; `metadata` :map (default: %{})
- Índices/chaves: index [participant_id]; unique [participant_id, system_code]; index [status]; index [system_code]; FK `participant_id` → `csd_participants`

### `custody_items`
- Módulo: `Monetarie.Schemas.Custody.CustodyItem` (`core/backend/lib/monetarie/schemas/custody/custody_item.ex:21`)
- Propósito: Títulos mantidos em custódia para clientes, com valor de face, emissor, datas de emissão, vencimento e liquidação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_id` :integer; `item_type` :string; `document_number` :string; `drawer_name` :string; `drawer_document` :string; `face_value` :integer; `issue_date` :date; `maturity_date` :date; `status` :string (default: "received"); `receipt_date` :date; `presentation_date` :date; `settlement_date` :date; `return_date` :date; `settled_amount` :integer; `settlement_reference` :string; `receipt_number` :string; `received_by` :binary_id; `received_by_name` :string; `converted_to_discount_id` :binary_id; `notes` :string; `metadata` :map (default: %{}); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [account_id]; index [branch_id]; index [drawer_document]; index [maturity_date]; index [member_id]; index [status]; FK `account_id` → `accounts`; FK `branch_id` → `branches`; FK `member_id` → `cooperative_members`

### `custody_movements`
- Módulo: `Monetarie.Schemas.Custody.CustodyMovement` (`core/backend/lib/monetarie/schemas/custody/custody_movement.ex:19`)
- Propósito: Movimentações de custódia de títulos e valores mobiliários, com tipo, data, executor e valor movimentado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `movement_type` :string; `movement_date` :date; `performed_by` :binary_id; `performed_by_name` :string; `amount` :integer; `notes` :string; `metadata` :map (default: %{}); `custody_item_id` belongs_to `CustodyItem`
- Índices/chaves: index [custody_item_id]; index [movement_date]; index [movement_type]; FK `custody_item_id` → `custody_items`

### `guarantee_rules`
- Módulo: `Monetarie.Schemas.Investments.GuaranteeRule` (`core/backend/lib/monetarie/schemas/investments/guarantee_rule.ex:13`)
- Propósito: Regras de garantia de investimento por tipo de instrumento e condição do emissor (FGC/FGCoop), com esquema e prioridade aplicáveis.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `kind_code` :string; `issuer_condition` :string; `scheme_code` :string; `priority` :integer (default: 100)
- Índices/chaves: index [:kind_code]; unique [:kind_code, :issuer_condition]

### `guarantee_schemes`
- Módulo: `Monetarie.Schemas.Investments.GuaranteeScheme` (`core/backend/lib/monetarie/schemas/investments/guarantee_scheme.ex:13`)
- Propósito: Esquemas de garantia de depósitos (FGC, FGCoop, DPGE, cover pool), com limite por titular, limite global e referência legal.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `limit_per_holder_cents` :integer; `limit_global_cents` :integer; `scope_description_pt` :string; `legal_reference` :string
- Índices/chaves: unique [:code]

### `institution_cosif_mapping`
- Módulo: `Monetarie.Schemas.Investments.InstitutionCosifMapping` (`core/backend/lib/monetarie/schemas/investments/institution_cosif_mapping.ex:13`)
- Propósito: Mapeamento de eventos de tesouraria e investimentos para códigos de conta COSIF, configurável por instituição em ambiente multi-tenant.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `evento` :string; `cosif_code` :string; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: unique [:institution_id, :evento]

### `institutions`
- Módulo: `Monetarie.Schemas.Investments.Institution` (`core/backend/lib/monetarie/schemas/investments/institution.ex:24`)
- Propósito: Instituição raiz (tenant) do módulo de investimentos multi-tenant, com ISPB, adesão ao FGC/FGCoop e conglomerado prudencial.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `ispb` :string; `cnpj` :string; `short_name` :string; `legal_name` :string; `type` Ecto.Enum; `fgc_member` :boolean (default: false); `fgc_join_date` :date; `fgcoop_member` :boolean (default: false); `fgcoop_join_date` :date; `conglomerate_code` :string; `feature_flags` :map (default: %{}); `active` :boolean (default: true)
- Índices/chaves: unique [:ispb]

### `instrument_kinds`
- Módulo: `Monetarie.Schemas.Investments.InstrumentKind` (`core/backend/lib/monetarie/schemas/investments/instrument_kind.ex:15`)
- Propósito: Catálogo global de tipos de instrumentos de investimento, com liquidez diária, valor mínimo, prazo e exigência de autorização.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `family` :integer; `liquidity_daily_allowed` :boolean (default: true); `min_amount_cents` :integer; `min_term_months` :integer; `requires_pr_authorization` :boolean (default: false); `guarantee_default` :string; `active` :boolean (default: true)
- Índices/chaves: unique [:code]; index [:family]

### `investment_movements`
- Módulo: `Monetarie.Schemas.Investments.InvestmentMovement` (`core/backend/lib/monetarie/schemas/investments/investment_movement.ex:8`)
- Propósito: Movimentações financeiras de investimentos (aplicação, resgate, rendimento), com contas de débito/crédito e saldo apurado após o movimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `kind` Ecto.Enum; `amount` :integer; `balance_after` :integer; `debit_account` :string; `credit_account` :string; `redemption_event_id` :binary_id; `description` :string; `movement_date` :date; `investment_id` belongs_to `Monetarie.Schemas.Investments.Investment`; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: index [:investment_id]; index [:movement_date]; index [:kind]; index [:redemption_event_id]

### `investment_products`
- Módulo: `Monetarie.Schemas.Investments.InvestmentProduct` (`core/backend/lib/monetarie/schemas/investments/investment_product.ex:8`)
- Propósito: Configuração de produtos de investimento em renda fixa, como CDB e LCI/LCA, com taxa, prazo, liquidez e carência de resgate.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `rate_type` Ecto.Enum; `rate_value_bps` :integer; `min_amount` :integer; `min_term_days` :integer (default: 1); `max_term_days` :integer; `liquidity_type` Ecto.Enum; `grace_period_days` :integer (default: 0); `early_redemption_allowed` :boolean (default: true); `active` :boolean (default: true); `description` :string; `cosif_account` :string; `provision_account` :string; `expense_account` :string; `tax_account` :string; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: unique [code]

### `investment_provisions`
- Módulo: `Monetarie.Schemas.Investments.InvestmentProvision` (`core/backend/lib/monetarie/schemas/investments/investment_provision.ex:8`)
- Propósito: Lançamentos de provisão sobre posições de investimento, com tipo, valor provisionado e saldo resultante.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `kind` Ecto.Enum; `amount` :integer; `balance_after` :integer; `provision_date` :date; `investment_id` belongs_to `Monetarie.Schemas.Investments.Investment`; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: index [:investment_id]; index [:provision_date]; index [:investment_id, :provision_date]

### `investment_transactions`
- Módulo: `Monetarie.Schemas.Investments.InvestmentTransaction` (`core/backend/lib/monetarie/schemas/investments/investment_transaction.ex:8`)
- Propósito: Movimentações de conta de investimento, como aportes, resgates e rendimentos, com IRRF e IOF descontados na operação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `kind` Ecto.Enum; `amount` :integer; `balance_after` :integer; `reference_rate_bps` :integer; `irrf_amount` :integer (default: 0); `iof_amount` :integer (default: 0); `description` :string; `transaction_date` :date; `investment_id` belongs_to `Monetarie.Schemas.Investments.Investment`; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: index [investment_id]; index [kind]; index [transaction_date]; FK `investment_id` → `investments`

### `investments`
- Módulo: `Monetarie.Schemas.Investments.Investment` (`core/backend/lib/monetarie/schemas/investments/investment.ex:8`)
- Propósito: Aplicações financeiras de investimento, com principal, saldo atual, rendimento acumulado, IRRF retido e data de vencimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `principal` :integer; `current_balance` :integer; `accrued_interest` :integer (default: 0); `irrf_withheld` :integer (default: 0); `rate_locked_bps` :integer; `application_date` :date; `maturity_date` :date; `last_accrual_date` :date; `status` Ecto.Enum; `contract_number` :string; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `product_id` belongs_to `Monetarie.Schemas.Investments.InvestmentProduct`; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`
- Índices/chaves: unique [contract_number]; index [maturity_date]; index [member_id]; index [product_id]; index [status]; FK `member_id` → `cooperative_members`; FK `product_id` → `investment_products`

### `ipca_curves`
- Módulo: `Monetarie.Schemas.Investments.IpcaCurve` (`core/backend/lib/monetarie/schemas/investments/ipca_curve.ex:12`)
- Propósito: Curva de juros real (IPCA+) por prazo (tenor), usada para precificação de títulos indexados à inflação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `date` :date; `tenor_days` :integer; `real_rate_bps` :integer; `source` :string (default: "tesouro_direto")
- Índices/chaves: unique [:date, :tenor_days, :source]; index [:date]

### `issuers`
- Módulo: `Monetarie.Schemas.Investments.Issuer` (`core/backend/lib/monetarie/schemas/investments/issuer.ex:18`)
- Propósito: Cadastro de emissoras de papéis de renda fixa, como Monetarie e Tesouro Nacional, com CNPJ, ISPB e participação no FGC/FGCoop.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `cnpj` :string; `ispb` :string; `type` Ecto.Enum; `fgc_member` :boolean (default: false); `fgcoop_member` :boolean (default: false); `conglomerate_code` :string; `active` :boolean (default: true)
- Índices/chaves: unique [:cnpj]

### `rf_coupon_events`
- Módulo: `Monetarie.Schemas.Investments.RfCouponEvent` (`core/backend/lib/monetarie/schemas/investments/rf_coupon_event.ex:13`)
- Propósito: Ledger idempotente de eventos de cupom apurado para posições de renda fixa, com data, valor e status de pagamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `coupon_date` :date; `amount` :integer; `status` :string (default: "recorded"); `recorded_at` :utc_datetime; `paid_at` :utc_datetime; `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`; `rf_position_id` belongs_to `Monetarie.Schemas.Investments.RfPosition`; `coupon_schedule_id` belongs_to `Monetarie.Schemas.Investments.CouponSchedule`
- Índices/chaves: unique [:rf_position_id, :coupon_schedule_id]; index [:institution_id, :status]; index [:coupon_date]

### `rf_instruments`
- Módulo: `Monetarie.Schemas.Investments.RfInstrument` (`core/backend/lib/monetarie/schemas/investments/rf_instrument.ex:18`)
- Propósito: Título de renda fixa negociável na mesa de RF, com tipo de cupom, indexador e cronograma de cupons por instituição.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `index` Ecto.Enum; `rate_bps` :integer; `coupon_type` Ecto.Enum; `coupon_frequency` Ecto.Enum (default: :none); `day_count_convention` Ecto.Enum (default: :actual_360); `instrument_kind_code` :string; `face_value` :integer; `issue_date` :date; `maturity_date` :date; `last_coupon_date` :date; `next_coupon_date` :date; `active` :boolean (default: true); `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`; `issuer_id` belongs_to `Monetarie.Schemas.Investments.Issuer`
- Índices/chaves: unique [:institution_id, :code]; index [:institution_id, :maturity_date]; index [:institution_id, :next_coupon_date]; index [:issuer_id]

### `rf_positions`
- Módulo: `Monetarie.Schemas.Investments.RfPosition` (`core/backend/lib/monetarie/schemas/investments/rf_position.ex:15`)
- Propósito: Posição de renda fixa por cooperado ou cliente, read model da mesa de investimentos, com quantidade, custo médio e resultado realizado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `member_id` :binary_id; `quantity` :integer (default: 1); `notional` :integer; `acquisition_date` :date; `acquisition_rate_bps` :integer; `avg_cost` :integer; `realized_pnl` :integer (default: 0); `status` Ecto.Enum (default: :active); `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`; `rf_instrument_id` belongs_to `Monetarie.Schemas.Investments.RfInstrument`
- Índices/chaves: index [:institution_id, :status]; index [:institution_id, :member_id]; index [:rf_instrument_id]

### `rf_trades`
- Módulo: `Monetarie.Schemas.Investments.RfTrade` (`core/backend/lib/monetarie/schemas/investments/rf_trade.ex:16`)
- Propósito: Ledger imutável de eventos de principal do book de renda fixa, com quantidade, preço, PnL realizado e lançamento COSIF.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` Ecto.Enum; `trade_date` :date; `quantity` :integer; `unit_price` :integer; `cash_amount` :integer; `realized_pnl` :integer (default: 0); `treasury_account_id` :binary_id; `treasury_movement_id` :binary_id; `cosif_journal_entry_id` :binary_id; `status` Ecto.Enum (default: :recorded); `institution_id` belongs_to `Monetarie.Schemas.Investments.Institution`; `rf_position_id` belongs_to `Monetarie.Schemas.Investments.RfPosition`
- Índices/chaves: index [:institution_id, :rf_position_id]; index [:institution_id, :event_type, :trade_date]

### `savings_accrual_records` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Registros de apropriação de rendimento de poupança do baseline legado, sem uso no código atual.
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `account_id` uuid NOT NULL; `product_type` character varying(255) NOT NULL; `accrual_date` date NOT NULL; `balance` bigint NOT NULL; `accrual_amount` bigint NOT NULL; `annual_rate_bps` integer NOT NULL; `idempotency_key` character varying(255) NOT NULL; `posted` boolean DEFAULT false NOT NULL; `posted_at` timestamp without time zone; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [account_id]; index [account_id, posted]; index [accrual_date]; unique [idempotency_key]

### `savings_product_definitions` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Definições de produtos de poupança do baseline legado, sem uso no código atual.
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `type` character varying(255) NOT NULL; `name` character varying(255) NOT NULL; `description` text; `annual_rate_bps` integer DEFAULT 0 NOT NULL; `accrual_frequency` character varying(255) DEFAULT 'daily'::character varying NOT NULL; `posting_frequency` character varying(255) DEFAULT 'monthly'::character varying NOT NULL; `min_balance` bigint DEFAULT 0 NOT NULL; `min_opening_balance` bigint DEFAULT 0 NOT NULL; `max_balance` bigint; `min_term_days` integer DEFAULT 0 NOT NULL; `max_term_days` integer; `early_withdrawal_penalty_bps` integer DEFAULT 0 NOT NULL; `withdrawal_limit_per_month` integer; `dormancy_days` integer DEFAULT 180 NOT NULL; `fgc_eligible` boolean DEFAULT true NOT NULL; `iof_exempt` boolean DEFAULT false NOT NULL; `ir_table` character varying(255) DEFAULT 'regressiva'::character varying NOT NULL; `regulatory_code` character varying(255); `active` boolean DEFAULT true NOT NULL; `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [active]; index [type]

### `savings_transactions` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Movimentações de contas de poupança do baseline legado, sem uso no código atual.
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `account_id` uuid NOT NULL; `type` character varying(255) NOT NULL; `amount` bigint NOT NULL; `balance_before` bigint NOT NULL; `balance_after` bigint NOT NULL; `description` character varying(255); `reference_id` character varying(255); `reference_type` character varying(255); `metadata` jsonb DEFAULT '{}'::jsonb NOT NULL; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [account_id]; index [inserted_at]; index [type]

### `securities_corporate_events`
- Módulo: `Monetarie.Schemas.Securities.CorporateEvent` (`core/backend/lib/monetarie/schemas/securities/corporate_event.ex:31`)
- Propósito: Eventos corporativos de títulos e valores mobiliários, como juros, amortização e resgate, com datas de evento, registro e pagamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `event_type` :string; `instrument_id` :binary_id; `event_date` :date; `record_date` :date; `payment_date` :date; `rate` :decimal; `amount_per_unit` :integer (default: 0); `status` :string (default: "SCHEDULED"); `metadata` :map (default: %{})
- Índices/chaves: index [event_date]; index [event_type]; index [instrument_id, event_date]; index [instrument_id]; index [status]; FK `instrument_id` → `master_data_instruments`

### `securities_guarantees`
- Módulo: `Monetarie.Schemas.Securities.Guarantee` (`core/backend/lib/monetarie/schemas/securities/guarantee.ex:29`)
- Propósito: Garantias ou penhor de títulos e valores mobiliários, com quantidade e valor empenhados e ISPB do beneficiário.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `position_id` :binary_id; `guarantee_type` :string; `pledged_quantity` :integer (default: 0); `pledged_value` :integer (default: 0); `beneficiary_ispb` :string; `start_date` :date; `end_date` :date; `status` :string (default: "ACTIVE"); `metadata` :map (default: %{})
- Índices/chaves: index [beneficiary_ispb]; index [guarantee_type]; index [position_id]; index [start_date, end_date]; index [status]; FK `position_id` → `securities_positions`

### `securities_orders`
- Módulo: `Monetarie.Schemas.Securities.Order` (`core/backend/lib/monetarie/schemas/securities/order.ex:39`)
- Propósito: Ordens de compra, venda ou transferência de títulos, com contraparte, quantidade, preço, liquidação e mensagem SPB vinculada.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `order_type` :string; `instrument_id` :binary_id; `account_id` :binary_id; `counterparty_ispb` :string; `quantity` :integer; `unit_price` :integer (default: 0); `total_amount` :integer (default: 0); `settlement_date` :date; `clearing` :string; `status` :string (default: "PENDING"); `spb_message_id` :string; `metadata` :map (default: %{})
- Índices/chaves: index [account_id]; index [clearing, settlement_date]; index [instrument_id]; index [order_type]; index [spb_message_id]; index [status]; FK `instrument_id` → `master_data_instruments`

### `securities_positions`
- Módulo: `Monetarie.Schemas.Securities.Position` (`core/backend/lib/monetarie/schemas/securities/position.ex:31`)
- Propósito: Posições de custódia de títulos e valores mobiliários por conta, com quantidade, custo médio, valor de mercado e clearing.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `account_id` :binary_id; `instrument_id` :binary_id; `clearing` :string; `quantity` :integer (default: 0); `average_cost` :integer (default: 0); `market_value` :integer (default: 0); `custody_account` :string; `position_date` :date; `status` :string (default: "ACTIVE"); `metadata` :map (default: %{})
- Índices/chaves: index [account_id, instrument_id]; unique [account_id, instrument_id, clearing, position_date]; index [clearing, position_date]; index [instrument_id]; index [status]; FK `instrument_id` → `master_data_instruments`

### `selic_rates`
- Módulo: `Monetarie.Schemas.Investments.SelicRate` (`core/backend/lib/monetarie/schemas/investments/selic_rate.ex:7`)
- Propósito: Histórico diário da taxa SELIC, em pontos-base e na forma anualizada, usado para indexação de investimentos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `date` :date; `rate_bps` :integer; `annualized_bps` :integer
- Índices/chaves: unique [date]

### `yield_curves`
- Módulo: `Monetarie.Schemas.Investments.YieldCurve` (`core/backend/lib/monetarie/schemas/investments/yield_curve.ex:12`)
- Propósito: Curva de juros pré-fixada nominal por prazo (tenor), dado de mercado global usado como referência de precificação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `date` :date; `tenor_days` :integer; `rate_bps` :integer; `source` :string (default: "tesouro_direto")
- Índices/chaves: unique [:date, :tenor_days, :source]; index [:date]

## 12. Tesouraria, liquidez, câmbio e meio circulante

### `accs_files`
- Módulo: `Monetarie.Schemas.Accs.AccsFile` (`core/backend/lib/monetarie/schemas/accs/accs_file.ex:29`)
- Propósito: Arquivos ACCS (Arquivo de Comunicação e Controle do STR) trocados com o BACEN, com sequência, total de registros e status de envio.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `file_date` :date; `sequence_number` :integer; `institution_cnpj` :string; `total_records` :integer (default: 0); `total_amount` :integer (default: 0); `status` :string (default: "generated"); `content` :string; `checksum` :string; `sent_at` :utc_datetime; `confirmed_at` :utc_datetime; `error_message` :string; `metadata` :map (default: %{})
- Índices/chaves: index [file_date]; unique [file_date, sequence_number]; index [status]

### `apt_ptax_files`
- Módulo: `Monetarie.Schemas.APT.PtaxFile` (`core/backend/lib/monetarie/schemas/apt/ptax_file.ex:18`)
- Propósito: Arquivos de boletins PTAX de câmbio, com taxas de compra, venda e paridade por moeda e data.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `file_date` :date; `currency_pair` :string; `currency_code` :string; `buy_rate` :integer; `sell_rate` :integer; `parity_rate` :integer; `source_file` :string; `bulletin_number` :string; `metadata` :map (default: %{})
- Índices/chaves: index [currency_pair]; unique [file_date, currency_pair]; index [file_date]

### `bank_statements`
- Módulo: `Monetarie.Schemas.Treasury.BankStatement` (`core/backend/lib/monetarie/schemas/treasury/bank_statement.ex:32`)
- Propósito: Linhas de extrato bancário importado para conciliação, com tipo de lançamento, saldo após o movimento e status de conciliação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `bank_code` :string; `account_number` :string; `statement_date` :date; `entry_type` :string; `amount` :integer; `balance_after` :integer; `description` :string; `document_number` :string; `counterpart_document` :string; `reconciliation_status` :string (default: "pending"); `reconciled_with_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [bank_code, statement_date]; index [reconciliation_status]

### `cambio_counterparties`
- Módulo: `Monetarie.Schemas.Cambio.Counterparty` (`core/backend/lib/monetarie/schemas/cambio/counterparty.ex:18`)
- Propósito: Cadastro de contrapartes de operações de câmbio, com ISPB, código SWIFT, país e classificação de risco.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `ispb` :string; `swift_code` :string; `country_code` :string; `risk_rating` :string; `is_active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: index [country_code]; index [is_active]; unique [ispb) WHERE (ispb IS NOT NULL]; unique [swift_code) WHERE (swift_code IS NOT NULL]

### `cambio_fx_contracts`
- Módulo: `Monetarie.Schemas.Cambio.FxContract` (`core/backend/lib/monetarie/schemas/cambio/fx_contract.ex:36`)
- Propósito: Contratos de câmbio (operações de FX), com taxa contratada e de liquidação, vencimento e registro ROF/RDE no BACEN.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `contract_type` :string; `currency_pair` :string; `notional_amount` :integer; `contracted_rate` :decimal; `settlement_rate` :decimal; `settlement_date` :date; `maturity_date` :date; `counterparty_id` :binary_id; `account_id` :binary_id; `status` :string (default: "DRAFT"); `rof_rde_number` :string; `spb_message_id` :string; `bcb_registration_id` :string; `metadata` :map (default: %{})
- Índices/chaves: index [account_id]; unique [bcb_registration_id) WHERE (bcb_registration_id IS NOT NULL]; index [counterparty_id]; index [currency_pair]; index [settlement_date]; index [spb_message_id) WHERE (spb_message_id IS NOT NULL]; index [status]; FK `counterparty_id` → `cambio_counterparties`

### `cambio_multi_currency_accounts`
- Módulo: `Monetarie.Schemas.Cambio.MultiCurrencyAccount` (`core/backend/lib/monetarie/schemas/cambio/multi_currency_account.ex:27`)
- Propósito: Contas em múltiplas moedas para operações de câmbio, controlando saldo disponível e saldo bloqueado por moeda.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `account_id` :binary_id; `currency_code` :string; `balance` :integer (default: 0); `available_balance` :integer (default: 0); `blocked_balance` :integer (default: 0); `status` :string (default: "ACTIVE"); `metadata` :map (default: %{})
- Índices/chaves: unique [account_id, currency_code]; index [status]

### `cambio_rof_rde_registrations`
- Módulo: `Monetarie.Schemas.Cambio.RofRde` (`core/backend/lib/monetarie/schemas/cambio/rof_rde.ex:36`)
- Propósito: Registra operações de câmbio via ROF/RDE, com tipo de investidor, valor em dólares, modalidade e status de resposta do BCB.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `registration_type` :string; `registration_number` :string; `contract_id` :binary_id; `investor_type` :string; `amount_usd` :integer; `modality` :string; `status` :string (default: "PENDING"); `bcb_response` :map (default: %{})
- Índices/chaves: index [contract_id]; unique [registration_number) WHERE (registration_number IS NOT NULL]; index [registration_type]; index [status]; FK `contract_id` → `cambio_fx_contracts`

### `cash_flow_projections`
- Módulo: `Monetarie.Schemas.Treasury.CashFlowProjection` (`core/backend/lib/monetarie/schemas/treasury/cash_flow_projection.ex:40`)
- Propósito: Projeções de fluxo de caixa da tesouraria, com categoria, valor projetado, valor real, variância e nível de confiança.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `projection_date` :date; `category` :string; `projected_amount` :integer; `actual_amount` :integer; `variance` :integer; `source` :string; `confidence_level` :string; `notes` :string; `metadata` :map (default: %{})
- Índices/chaves: index [projection_date, category]

### `cde_identifications`
- Módulo: `Monetarie.Schemas.CDE.Identification` (`core/backend/lib/monetarie/schemas/cde/identification.ex:18`)
- Propósito: Registro de identificação de participante ou entidade (CPF, CNPJ, ISPB) para validação documental e verificações de compliance.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `document_type` :string; `document_number` :string; `name` :string; `status` :string (default: "PENDING"); `validation_date` :date; `expiration_date` :date; `issuer` :string; `country_code` :string (default: "BRA"); `metadata` :map (default: %{})
- Índices/chaves: unique [document_type, document_number]; index [document_type]; index [name]; index [status]

### `compulsorios_bases_calculo`
- Módulo: `Monetarie.Schemas.Compulsorios.BaseCalculo` (`core/backend/lib/monetarie/schemas/compulsorios/base_calculo.ex:35`)
- Propósito: Bases de cálculo do recolhimento compulsório junto ao BACEN, com saldo médio, exigibilidade e excesso ou déficit apurado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `calculation_type` :string; `reference_date` :date; `average_balance` :integer (default: 0); `required_deposit` :integer (default: 0); `excess_deficit` :integer (default: 0); `status` :string (default: "CALCULATED"); `metadata` :map (default: %{})
- Índices/chaves: index [calculation_type]; index [calculation_type, reference_date]; index [reference_date]; index [status]; unique [calculation_type, reference_date]

### `compulsorios_demonstrativos`
- Módulo: `Monetarie.Schemas.Compulsorios.Demonstrativo` (`core/backend/lib/monetarie/schemas/compulsorios/demonstrativo.ex:31`)
- Propósito: Demonstrativos de cumprimento de depósitos compulsórios exigidos pelo BACEN, com valores requeridos, depositados e status de conformidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `demonstrative_type` :string; `reference_period` :string; `total_required` :integer (default: 0); `total_deposited` :integer (default: 0); `compliance_status` :string (default: "PENDING"); `bcb_submission_date` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [bcb_submission_date]; index [compliance_status]; index [demonstrative_type]; index [reference_period]; unique [demonstrative_type, reference_period]

### `compulsorios_recolhimentos`
- Módulo: `Monetarie.Schemas.Compulsorios.Recolhimento` (`core/backend/lib/monetarie/schemas/compulsorios/recolhimento.ex:36`)
- Propósito: Registra recolhimentos de depósito compulsório ao Banco Central, com tipo, valor, data de referência e confirmação do BCB.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `deposit_type` :string; `amount` :integer (default: 0); `reference_date` :date; `settlement_date` :date; `base_calculo_id` :binary_id; `bcb_confirmation_id` :string; `status` :string (default: "PENDING"); `metadata` :map (default: %{})
- Índices/chaves: index [base_calculo_id]; index [bcb_confirmation_id]; index [deposit_type]; index [reference_date]; index [settlement_date]; index [status]; FK `base_calculo_id` → `compulsorios_bases_calculo`

### `dpo_deposits`
- Módulo: `Monetarie.Schemas.DPO.Deposit` (`core/backend/lib/monetarie/schemas/dpo/deposit.ex:21`)
- Propósito: Depósitos no sistema financeiro (à vista, a prazo, poupança, judicial ou garantia), com depositante, indexador e datas de vencimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `deposit_type` :string; `amount` :integer; `depositor_document` :string; `depositor_name` :string; `account_id` :string; `bank_ispb` :string; `status` :string (default: "ACTIVE"); `interest_rate` :integer; `index_code` :string; `maturity_date` :date; `deposit_date` :date; `redemption_date` :date; `contract_number` :string; `metadata` :map (default: %{})
- Índices/chaves: index [bank_ispb]; unique [contract_number]; index [deposit_type]; index [deposit_type, status]; index [depositor_document]; index [maturity_date]; index [status]

### `liquidity_reserves`
- Módulo: `Monetarie.Schemas.Treasury.LiquidityReserve` (`core/backend/lib/monetarie/schemas/treasury/liquidity_reserve.ex:7`)
- Propósito: Cálculo de recolhimento compulsório e encaixe de liquidez sobre depósitos à vista, com índice LCR e status de conformidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_date` :date; `demand_deposits_total` :integer; `compulsory_rate_bps` :integer; `compulsory_required` :integer; `compulsory_held` :integer; `compulsory_surplus_deficit` :integer; `encaixe_required` :integer; `encaixe_held` :integer; `lcr_ratio_bps` :integer; `status` Ecto.Enum
- Índices/chaves: unique [reference_date]

### `liquidity_snapshots`
- Módulo: `Monetarie.Schemas.Treasury.LiquiditySnapshot` (`core/backend/lib/monetarie/schemas/treasury/liquidity_snapshot.ex:32`)
- Propósito: Instantâneos diários de monitoramento de liquidez, com ativos, passivos, posição líquida, saldo na Conta PI e nível de alerta.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `snapshot_date` :date; `total_assets` :integer; `total_liabilities` :integer; `net_position` :integer; `reserve_balance` :integer; `pi_balance` :integer; `available_liquidity` :integer; `liquidity_ratio` :integer; `alert_level` :string (default: "normal"); `metadata` :map (default: %{})
- Índices/chaves: unique [snapshot_date]

### `meio_circulante_denominations`
- Módulo: `Monetarie.Schemas.MeioCirculante.Denomination` (`core/backend/lib/monetarie/schemas/meio_circulante/denomination.ex:33`)
- Propósito: Cadastro de cédulas e moedas do meio circulante, com valor, série, ano de emissão e situação de curso.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `denomination_type` :string; `value` :integer; `currency_code` :string (default: "BRL"); `series` :string; `year` :integer; `is_active` :boolean (default: true)
- Índices/chaves: index [denomination_type]; index [is_active]; unique [denomination_type, value, currency_code, series]; index [value]

### `meio_circulante_requisitions`
- Módulo: `Monetarie.Schemas.MeioCirculante.Requisition` (`core/backend/lib/monetarie/schemas/meio_circulante/requisition.ex:26`)
- Propósito: Pedidos de numerário (meio circulante) ao Banco Central, com cofre, denominação, quantidade solicitada e protocolo BCB.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `requisition_number` :string; `vault_id` :binary_id; `denomination_id` :binary_id; `requested_quantity` :integer; `approved_quantity` :integer; `bcb_protocol` :string; `status` :string (default: "DRAFT"); `requested_date` :date; `delivery_date` :date; `metadata` :map (default: %{})
- Índices/chaves: index [bcb_protocol]; index [denomination_id]; index [requested_date]; unique [requisition_number]; index [status]; index [vault_id]; FK `denomination_id` → `meio_circulante_denominations`; FK `vault_id` → `meio_circulante_vaults`

### `meio_circulante_supplies`
- Módulo: `Monetarie.Schemas.MeioCirculante.Supply` (`core/backend/lib/monetarie/schemas/meio_circulante/supply.ex:27`)
- Propósito: Entregas e devoluções de numerário (cédulas e moedas) ao BACEN, com número, cofre de origem, protocolo e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `supply_number` :string; `vault_id` :binary_id; `denomination_id` :binary_id; `quantity` :integer; `bcb_protocol` :string; `status` :string (default: "DRAFT"); `collection_date` :date; `metadata` :map (default: %{})
- Índices/chaves: index [bcb_protocol]; index [collection_date]; index [denomination_id]; index [status]; unique [supply_number]; index [vault_id]; FK `denomination_id` → `meio_circulante_denominations`; FK `vault_id` → `meio_circulante_vaults`

### `meio_circulante_vaults`
- Módulo: `Monetarie.Schemas.MeioCirculante.Vault` (`core/backend/lib/monetarie/schemas/meio_circulante/vault.ex:24`)
- Propósito: Cofres físicos de tesouraria (meio circulante) por agência, controlando quantidade de cédulas/moedas por denominação e última contagem.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `vault_code` :string; `branch_id` :binary_id; `denomination_id` :binary_id; `quantity` :integer (default: 0); `last_count_date` :date; `status` :string (default: "ACTIVE"); `metadata` :map (default: %{})
- Índices/chaves: index [branch_id, denomination_id]; index [branch_id]; index [denomination_id]; index [status]; unique [vault_code]; FK `denomination_id` → `meio_circulante_denominations`

### `reconciliation_entries`
- Módulo: `Monetarie.Schemas.Treasury.ReconciliationEntry` (`core/backend/lib/monetarie/schemas/treasury/reconciliation_entry.ex:31`)
- Propósito: Registros de conciliação entre lançamentos internos e extrato bancário, com tipo e confiança do casamento e diferença de valor.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `internal_transaction_id` :string; `match_type` :string; `match_confidence` :integer; `amount_difference` :integer; `notes` :string; `reconciled_by` :string; `reconciled_at` :utc_datetime; `bank_statement_id` belongs_to `Monetarie.Schemas.Treasury.BankStatement`
- Índices/chaves: index [bank_statement_id]; FK `bank_statement_id` → `bank_statements`

### `treasury_accounts`
- Módulo: `Monetarie.Schemas.Treasury.TreasuryAccount` (`core/backend/lib/monetarie/schemas/treasury/treasury_account.ex:8`)
- Propósito: Contas de tesouraria mantidas em outras instituições, com agência, número da conta, ISPB e contas COSIF de débito e crédito.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `bank_name` :string; `bank_code` :string; `ispb` :string; `agency` :string; `account_number` :string; `account_type` :string (default: "bank"); `cosif_debit` :string; `cosif_credit` :string; `status` :string (default: "active"); `metadata` :map (default: %{})
- Índices/chaves: unique [:code]

### `treasury_auctions`
- Módulo: `Monetarie.Schemas.TreasuryBcb.Auction` (`core/backend/lib/monetarie/schemas/treasury_bcb/auction.ex:34`)
- Propósito: Leilões de títulos do Tesouro/BCB (grupo LEI), com tipo de instrumento, data, valor total aceito e taxa de corte.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `auction_number` :string; `auction_type` :string; `instrument_type` :string; `auction_date` :date; `settlement_date` :date; `total_amount` :integer (default: 0); `accepted_amount` :integer (default: 0); `cut_rate` :decimal; `status` :string (default: "ANNOUNCED"); `metadata` :map (default: %{})
- Índices/chaves: index [auction_date]; unique [auction_number]; index [auction_type]; index [settlement_date]; index [status]

### `treasury_bids`
- Módulo: `Monetarie.Schemas.TreasuryBcb.Bid` (`core/backend/lib/monetarie/schemas/treasury_bcb/bid.ex:27`)
- Propósito: Lances (propostas) em leilões de tesouraria, com taxa, quantidade ofertada e quantidade aceita por instituição participante.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `auction_id` :binary_id; `participant_ispb` :string; `rate` :decimal; `quantity` :integer (default: 0); `amount` :integer (default: 0); `status` :string (default: "SUBMITTED"); `accepted_quantity` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: index [auction_id]; index [participant_ispb]; index [status]; FK `auction_id` → `treasury_auctions`

### `treasury_collateral`
- Módulo: `Monetarie.Schemas.TreasuryBcb.Collateral` (`core/backend/lib/monetarie/schemas/treasury_bcb/collateral.ex:36`)
- Propósito: Garantias (colateral) de tesouraria depositadas junto ao BACEN/SELIC, com tipo, quantidade, deságio (haircut) e valor empenhado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `collateral_type` :string; `instrument_id` :binary_id; `participant_ispb` :string; `quantity` :integer (default: 0); `market_value` :integer (default: 0); `haircut_pct` :integer (default: 0); `pledged_value` :integer (default: 0); `status` :string (default: "PLEDGED"); `metadata` :map (default: %{})
- Índices/chaves: index [collateral_type]; index [instrument_id]; index [participant_ispb]; index [status]

### `treasury_history_codes`
- Módulo: `Monetarie.Schemas.Treasury.TreasuryHistoryCode` (`core/backend/lib/monetarie/schemas/treasury/treasury_history_code.ex:8`)
- Propósito: Códigos históricos de lançamentos de tesouraria, definindo natureza débito/crédito, conta contábil e conta de contrapartida.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `category` :string (default: "other"); `debit_credit` :string; `counterpart_account` :string; `accounting_code` :string; `group_code` :string; `requires_member` :boolean (default: false); `requires_destination` :boolean (default: false); `active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [:code]

### `treasury_liquidity_lines`
- Módulo: `Monetarie.Schemas.TreasuryBcb.LiquidityLine` (`core/backend/lib/monetarie/schemas/treasury_bcb/liquidity_line.ex:37`)
- Propósito: Linhas de liquidez do BACEN do grupo LFL, com limite, valor utilizado e disponível por instituição participante.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `line_type` :string; `participant_ispb` :string; `limit_amount` :integer (default: 0); `used_amount` :integer (default: 0); `available_amount` :integer (default: 0); `rate` :decimal; `status` :string (default: "ACTIVE"); `metadata` :map (default: %{})
- Índices/chaves: index [line_type]; index [participant_ispb]; index [status]

### `treasury_movements`
- Módulo: `Monetarie.Schemas.Treasury.TreasuryMovement` (`core/backend/lib/monetarie/schemas/treasury/treasury_movement.ex:8`)
- Propósito: Movimentos financeiros da tesouraria, com tipo de lançamento, contrato vinculado, indicação de transferência e estorno de movimento anterior.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `movement_date` :date; `amount` :integer (default: 0); `document_number` :string; `description` :string; `complement` :string; `effective_date` :date; `entry_type` :string (default: "manual"); `contract_number` :string; `is_transfer` :boolean (default: false); `journal_entry_id` :binary_id; `status` :string (default: "active"); `reversal_of_id` :binary_id; `dekla_mov_id` :integer; `metadata` :map (default: %{}); `treasury_account_id` belongs_to `Monetarie.Schemas.Treasury.TreasuryAccount`; `history_code_id` belongs_to `Monetarie.Schemas.Treasury.TreasuryHistoryCode`; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `destination_account_id` belongs_to `Monetarie.Schemas.Treasury.TreasuryAccount`; `operator_id` belongs_to `Monetarie.Schemas.Platform.Admin`
- Índices/chaves: index [:treasury_account_id]; index [:history_code_id]; index [:movement_date]; index [:member_id]; index [:destination_account_id]

### `treasury_reconciliation_snapshots`
- Módulo: `Monetarie.Schemas.Treasury.ReconciliationSnapshot` (`core/backend/lib/monetarie/schemas/treasury/reconciliation_snapshot.ex:17`)
- Propósito: Execução de reconciliação entre a posição da Conta PI na cabine PIX e o razão do Core, com saldo e desvio.
- Chave/particionamento: PK `id` binary_id (padrão); timestamps (type: :utc_datetime)
- Colunas: `checked_at` :utc_datetime_usec; `status` :string; `window_days` :integer; `cabin_balance_subcent` :integer; `cabin_blocked_subcent` :integer; `cabin_as_of` :utc_datetime_usec; `cabin_source` :string; `cabin_ispb` :string; `core_balance_subcent` :integer; `drift_subcent` :integer; `differences_count` :integer; `error` :string
- Índices/chaves: index [:checked_at]

### `treasury_redesconto`
- Módulo: `Monetarie.Schemas.TreasuryBcb.Redesconto` (`core/backend/lib/monetarie/schemas/treasury_bcb/redesconto.ex:34`)
- Propósito: Operações de redesconto junto ao Banco Central (grupo RDC), com participante, valor, taxa, garantia e vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `operation_type` :string; `participant_ispb` :string; `amount` :integer (default: 0); `rate` :decimal; `collateral_id` :binary_id; `start_date` :date; `end_date` :date; `status` :string (default: "REQUESTED"); `metadata` :map (default: %{})
- Índices/chaves: index [operation_type]; index [participant_ispb]; index [start_date, end_date]; index [status]

## 13. Cooperativa (legado societário)

### `assemblies`
- Módulo: `Monetarie.Schemas.Cooperative.Assembly` (`core/backend/lib/monetarie/schemas/cooperative/assembly.ex:13`)
- Propósito: Assembleias gerais de cooperativa de crédito, com tipo, quórum exigido e presente, ata e status de encerramento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `cooperative_id` :binary_id; `assembly_type` :string; `title` :string; `description` :string; `scheduled_date` :utc_datetime; `quorum_required` :integer; `quorum_present` :integer (default: 0); `status` :string (default: "scheduled"); `minutes_text` :string; `closed_at` :utc_datetime
- Índices/chaves: index [cooperative_id]; index [scheduled_date]; index [status]; FK `cooperative_id` → `entities`

### `assembly_resolutions`
- Módulo: `Monetarie.Schemas.Cooperative.AssemblyResolution` (`core/backend/lib/monetarie/schemas/cooperative/assembly_resolution.ex:12`)
- Propósito: Pautas e resoluções deliberadas em assembleia da cooperativa, com votos a favor, contra, abstenções e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `resolution_number` :integer; `title` :string; `description` :string; `votes_for` :integer (default: 0); `votes_against` :integer (default: 0); `votes_abstain` :integer (default: 0); `status` :string (default: "pending"); `assembly_id` belongs_to `Monetarie.Schemas.Cooperative.Assembly`
- Índices/chaves: index [assembly_id]; unique [assembly_id, resolution_number]; FK `assembly_id` → `assemblies`

### `assembly_votes`
- Módulo: `Monetarie.Schemas.Cooperative.AssemblyVote` (`core/backend/lib/monetarie/schemas/cooperative/assembly_vote.ex:13`)
- Propósito: Voto individual de cooperado em deliberações de assembleia, com o sentido do voto, método de votação e data.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `vote` :string; `voted_at` :utc_datetime; `vote_method` :string (default: "presential"); `assembly_id` belongs_to `Monetarie.Schemas.Cooperative.Assembly`; `resolution_id` belongs_to `Monetarie.Schemas.Cooperative.AssemblyResolution`; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`; `proxy_member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: unique [:resolution_id, :member_id]; index [:assembly_id]; index [:member_id]

### `beneficial_owners`
- Módulo: `Monetarie.Schemas.Cooperative.BeneficialOwner` (`core/backend/lib/monetarie/schemas/cooperative/beneficial_owner.ex:12`)
- Propósito: Beneficiários finais de cooperados pessoa jurídica, conforme Resolução CMN 4.753/2019, com percentual de participação e indicação de PEP.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `cpf_cnpj` :string; `birth_date` :date; `nationality` :string (default: "Brasileira"); `ownership_percentage` :decimal; `role` :string; `is_pep` :boolean (default: false); `doc_type` :string; `doc_number` :string; `doc_issuer` :string; `powers` :string; `mandate_start` :date; `mandate_end` :date; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]; unique [:member_id, :cpf_cnpj]

### `branches`
- Módulo: `Monetarie.Schemas.Cooperative.Branch` (`core/backend/lib/monetarie/schemas/cooperative/branch.ex:15`)
- Propósito: Agências da cooperativa de crédito, com código, CNPJ, razão social, nome fantasia, atributo BACEN e endereço completo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `cnpj` :string; `legal_name` :string; `trade_name` :string; `bcb_attribute` :string; `address_street` :string; `address_number` :string; `address_complement` :string; `address_neighborhood` :string; `address_city` :string; `address_state` :string; `address_zip` :string; `phone` :string; `email` :string; `manager_name` :string; `status` :string (default: "active"); `is_headquarters` :boolean (default: false); `metadata` :map (default: %{})
- Índices/chaves: unique [code]; index [status]

### `capital_transactions`
- Módulo: `Monetarie.Schemas.Cooperative.CapitalShare` (`core/backend/lib/monetarie/schemas/cooperative/capital_share.ex:14`)
- Propósito: Movimentações de capital social de cooperados, com tipo, valor, conta, transferência no TigerBeetle e aprovação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `transaction_type` :string; `total_value` :integer; `account_number` :string; `reference_date` :date; `description` :string; `status` :string (default: "completed"); `tigerbeetle_transfer_id` :binary_id; `approved_by` :binary_id; `metadata` :map (default: %{}); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [member_id]; index [member_id, reference_date]; index [reference_date]; index [status]; index [transaction_type]; FK `member_id` → `cooperative_members`

### `cooperative_members`
- Módulo: `Monetarie.Schemas.Cooperative.Member` (`core/backend/lib/monetarie/schemas/cooperative/member.ex:15`)
- Propósito: Associados e cooperados da cooperativa de crédito, com número de matrícula, datas de admissão e exclusão, CPF/CNPJ e dados pessoais.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `member_number` :string; `admission_date` :date; `exclusion_date` :date; `exclusion_reason` :string; `status` :string (default: "active"); `member_type` :string (default: "pessoa_fisica"); `cpf_cnpj` :string; `name` :string; `email` :string; `phone` :string; `mother_name` :string; `father_name` :string; `birth_date` :date; `marital_status` :string; `nationality` :string (default: "Brasileira"); `occupation` :string; `income_range` :string; `voting_rights` :boolean (default: true); `is_pep` :boolean (default: false); `address_street` :string; `address_number` :string; `address_complement` :string; `address_neighborhood` :string; `address_city` :string; `address_state` :string; `address_zip` :string; `shares_count` :integer (default: 0); `shares_value` :integer (default: 0); `metadata` :map (default: %{}); `kyc_expires_at` :utc_datetime; `kyc_risk_level` :string (default: "low"); `kyc_last_reviewed_at` :utc_datetime; `doc_type` :string; `doc_number` :string; `doc_issuer` :string; `doc_issuer_state` :string; `doc_issued_at` :date; `doc_expires_at` :date; `source_of_funds` :string; `account_purpose` :string; `employer_registration` :string; `employer_cnpj` :string; `employer_name` :string; `monthly_income` :decimal; `porte_scr` :integer (default: 0); `admission_book` :string; `data_constituicao` :date; `natureza_juridica` :string; `cnae_principal` :string; `capital_social` :decimal; `annual_revenue` :decimal; `user_id` :integer; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`; `employer_id` belongs_to `Monetarie.Schemas.Credit.Payroll.Employer`
- Índices/chaves: index [:employer_registration]; FK `branch_id` → `branches`; FK `user_id` → `users`

### `fates_transactions` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260308000004_create_cooperative_modules.exs`
- Propósito: Tabela legada do baseline com movimentações do FATES da cooperativa, sem uso no código atual.
- Colunas: `id` :binary_id; `description` :string; `amount_cents` :integer; `transaction_type` :string; `category` :string; `reference_date` :date; `approved_by` :string

### `fgcoop_contributions`
- Módulo: `Monetarie.Schemas.Cooperative.FgcoopContribution` (`core/backend/lib/monetarie/schemas/cooperative/fgcoop_contribution.ex:20`), `Monetarie.Schemas.Regulatory.FGCoop.Contribution` (`core/backend/lib/monetarie/schemas/regulatory/fgcoop/contribution.ex:12`)
- Propósito: Contribuições mensais ao FGCoop por cooperativa, calculadas sobre depósitos garantidos conforme a Resolução CMN 4.284/2013.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `cooperative_id` :binary_id; `reference_month` :date; `reference_date` :date; `depositos_vista` :integer (default: 0); `rdc` :integer (default: 0); `lci` :integer (default: 0); `lca` :integer (default: 0); `poupanca` :integer (default: 0); `base_amount` :integer (default: 0); `rate_bps` :integer (default: 125); `contribution_amount` :integer; `total_guaranteed_deposits` :integer; `status` :string (default: "pending"); `paid_at` :utc_datetime; `tigerbeetle_transfer_id` :binary_id
- Índices/chaves: index [cooperative_id]; unique [cooperative_id, reference_month]; unique [reference_date]; index [status]; FK `cooperative_id` → `entities`

### `member_assets`
- Módulo: `Monetarie.Schemas.Cooperative.MemberAsset` (`core/backend/lib/monetarie/schemas/cooperative/member_asset.ex:8`)
- Propósito: Cadastro de bens patrimoniais do cooperado, como veículos e imóveis, com valor, data de aquisição, placa, RENAVAM e chassi.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `asset_type` :string; `description` :string; `value` :integer (default: 0); `acquisition_date` :date; `registration_number` :string; `address` :string; `plate` :string; `brand` :string; `model` :string; `year` :integer; `renavam` :string; `chassis` :string; `registry_cns` :string; `notes` :string; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]

### `member_dependents`
- Módulo: `Monetarie.Schemas.Cooperative.MemberDependent` (`core/backend/lib/monetarie/schemas/cooperative/member_dependent.ex:8`)
- Propósito: Dependentes cadastrados de cooperados, com nome, CPF, data de nascimento e grau de parentesco.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `cpf` :string; `birth_date` :date; `relationship_type` :string; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]; unique [:member_id, :cpf]

### `member_employers`
- Módulo: `Monetarie.Schemas.Cooperative.MemberEmployer` (`core/backend/lib/monetarie/schemas/cooperative/member_employer.ex:11`)
- Propósito: Vínculo empregatício de cooperados e membros, com CNPJ e nome do empregador, período de vínculo e tipo de emprego.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `employer_cnpj` :string; `employer_name` :string; `employer_registration` :string; `start_date` :date; `end_date` :date; `employment_type` :string; `status` :string (default: "active"); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]

### `member_income_sources`
- Módulo: `Monetarie.Schemas.Cooperative.MemberIncomeSource` (`core/backend/lib/monetarie/schemas/cooperative/member_income_source.ex:8`)
- Propósito: Fontes de renda declaradas por um cooperado ou associado, com tipo, empregador e valor, usadas na análise de crédito.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `income_type` :string; `description` :string; `employer_name` :string; `value` :integer; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]; unique [:member_id, :income_type]

### `member_legal_representatives`
- Módulo: `Monetarie.Schemas.Cooperative.LegalRepresentative` (`core/backend/lib/monetarie/schemas/cooperative/legal_representative.ex:12`)
- Propósito: Representantes legais de cooperados pessoa jurídica, conforme Resolução CMN 4.753/2019, com poderes outorgados e vigência do mandato.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `name` :string; `cpf` :string; `birth_date` :date; `nationality` :string (default: "Brasileira"); `email` :string; `phone` :string; `powers` :string; `mandate_start` :date; `mandate_end` :date; `doc_type` :string; `doc_number` :string; `doc_issuer` :string; `is_pep` :boolean (default: false); `is_active` :boolean (default: true); `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]; unique [:member_id, :cpf]

### `member_references`
- Módulo: `Monetarie.Schemas.Cooperative.MemberReference` (`core/backend/lib/monetarie/schemas/cooperative/member_reference.ex:8`)
- Propósito: Referências bancárias ou pessoais informadas pelo cooperado no cadastro, com instituição, agência, conta e contato.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_type` :string; `institution_name` :string; `agency` :string; `account` :string; `phone` :string; `contact_name` :string; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]

### `ombudsman_cases`
- Módulo: `Monetarie.Schemas.Cooperative.OmbudsmanCase` (`core/backend/lib/monetarie/schemas/cooperative/ombudsman_case.ex:24`)
- Propósito: Casos de ouvidoria da cooperativa, com protocolo, canal, categoria, prioridade, prazo e resolução do atendimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `protocol` :string; `channel` :string; `category` :string; `subject` :string; `description` :string; `status` :string (default: "open"); `priority` :string (default: "normal"); `assigned_to` :string; `resolution` :string; `deadline` :utc_datetime; `resolved_at` :utc_datetime; `closed_at` :utc_datetime; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`

### `refund_balances`
- Módulo: `Monetarie.Schemas.Cooperative.RefundBalance` (`core/backend/lib/monetarie/schemas/cooperative/refund_balance.ex:8`)
- Propósito: Saldos remanescentes a devolver a clientes com conta encerrada, controlando valor original, valor pago e valor restante.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `account_number` :string; `cpf_cnpj` :string; `name` :string; `person_type` :string (default: "F"); `reference_date` :date; `account_closure_date` :date; `original_amount` :integer; `paid_amount` :integer (default: 0); `remaining_amount` :integer; `status` :string (default: "pending"); `registration_number` :string; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`
- Índices/chaves: index [:member_id]; index [:status]; index [:cpf_cnpj]; unique [:account_number, :reference_date]

### `refund_payments`
- Módulo: `Monetarie.Schemas.Cooperative.RefundPayment` (`core/backend/lib/monetarie/schemas/cooperative/refund_payment.ex:8`)
- Propósito: Pagamentos de parcelas de restituição de capital ou quotas ao cooperado, com número da parcela, vencimento e modalidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `installment_number` :integer; `due_date` :date; `amount` :integer; `paid_date` :date; `payment_type` :string; `modality_code` :string; `refund_balance_id` belongs_to `Monetarie.Schemas.Cooperative.RefundBalance`
- Índices/chaves: index [:refund_balance_id]; unique [:refund_balance_id, :installment_number]

### `service_points`
- Módulo: `Monetarie.Schemas.Cooperative.ServicePoint` (`core/backend/lib/monetarie/schemas/cooperative/service_point.ex:13`)
- Propósito: Postos de Atendimento (PA) vinculados a uma agência da cooperativa, com código, tipo e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `type` :string; `status` :string (default: "active"); `metadata` :map (default: %{}); `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: unique [branch_id, code]; index [branch_id]; index [status]; FK `branch_id` → `branches`

### `shares`
- Módulo: `Monetarie.Schemas.Cooperative.Share` (`core/backend/lib/monetarie/schemas/cooperative/share.ex:17`)
- Propósito: Quotas-parte individuais de cooperado, com quantidade, valor unitário e total, subscrição, integralização e resgate.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `quantity` :integer (default: 0); `unit_value_cents` :integer; `total_value_cents` :integer; `status` :string (default: "subscribed"); `subscribed_at` :utc_datetime; `paid_at` :utc_datetime; `redeemed_at` :utc_datetime; `member_id` belongs_to `Monetarie.Schemas.Cooperative.Member`

### `surplus_allocations` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Destinações de sobras da cooperativa por exercício (legado societário do baseline).
- Colunas: `id` uuid NOT NULL; `surplus_distribution_id` uuid NOT NULL; `member_id` uuid NOT NULL; `allocated_amount` integer DEFAULT 0 NOT NULL; `allocation_percentage` numeric DEFAULT 0 NOT NULL; `capital_transaction_id` uuid; `status` character varying(255) DEFAULT 'pending'::character varying NOT NULL; `inserted_at` timestamp(0) without time zone NOT NULL; `updated_at` timestamp(0) without time zone NOT NULL
- Índices/chaves: index [member_id]; index [status]; index [surplus_distribution_id]; unique [surplus_distribution_id, member_id]; FK `member_id` → `cooperative_members`; FK `surplus_distribution_id` → `surplus_distributions`

### `surplus_distributions` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Distribuições de sobras aos cooperados (rateio por conta) do legado societário do baseline.
- Colunas: `id` uuid NOT NULL; `fiscal_year` integer NOT NULL; `gross_surplus` integer NOT NULL; `fates_reserve` integer NOT NULL; `legal_reserve` integer NOT NULL; `other_reserves` integer DEFAULT 0 NOT NULL; `distributable_surplus` integer NOT NULL; `distribution_method` character varying(255) NOT NULL; `status` character varying(255) DEFAULT 'draft'::character varying NOT NULL; `approved_by` uuid; `approved_at` timestamp without time zone; `distributed_at` timestamp without time zone; `metadata` jsonb DEFAULT '{}'::jsonb; `inserted_at` timestamp(0) without time zone NOT NULL; `updated_at` timestamp(0) without time zone NOT NULL; `fates_cosif_account_group` character varying(255) DEFAULT 'PASSIVO'::character varying NOT NULL
- Índices/chaves: unique [fiscal_year) WHERE ((status)::text <> 'cancelled'::text]; index [fiscal_year]; index [status]

## 14. Regulatório BACEN/RFB (SCR, e-Financeira, CADOC, CCS, DERE, RC6 e afins)

### `cadoc1201_records`
- Módulo: `Monetarie.Schemas.Regulatory.Cadoc1201Record` (`core/backend/lib/monetarie/schemas/regulatory/cadoc1201_record.ex:33`)
- Propósito: Snapshot mensal de estatísticas do PIX para o CADOC 1201/APIX001, com transações, devoluções, bloqueios cautelares e latência de liquidação SPI.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps
- Colunas: `entity_id` Ecto.UUID; `reference_year` :integer; `reference_month` :integer; `reference_date` :date; `ispb` :string; `tipo_envio` :string (default: "I"); `transacoes` {:array, :map} (default: []); `devolucoes` {:array, :map} (default: []); `bloqueios_cautelares` {:array, :map} (default: []); `receitas` {:array, :map} (default: []); `tempo_p50_liq_spi_ms` :integer (default: 0); `tempo_p99_liq_spi_ms` :integer (default: 0); `tempo_p50_liq_fora_spi_ms` :integer (default: 0); `tempo_p99_liq_fora_spi_ms` :integer (default: 0); `tempo_max_bloqueio_cautelar_ms` :integer (default: 0); `dict_p99_consulta_ms` :integer (default: 0); `dict_perc_envio_registro_ms` :integer (default: 0); `dict_perc_exp_registro_ms` :integer (default: 0); `dict_perc_exp_exclusao_ms` :integer (default: 0); `dict_perc_notif_portabilidade_ms` :integer (default: 0); `dict_perc_envio_portabilidade_ms` :integer (default: 0); `dict_perc_abertura_med_ms` :integer (default: 0); `consultas_dict_qtd` :integer (default: 0); `disponibilidade_basis_points` :integer (default: 0); `autz_p95_tempo_ms` :integer (default: 0); `autorizacoes` {:array, :map} (default: []); `resp_nome` :string; `resp_email` :string; `resp_telefone` :string; `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{}); `source_transactions_count` :integer (default: 0); `generation_hash` :string

### `cadoc5011_records`
- Módulo: `Monetarie.Schemas.Regulatory.Cadoc5011.Cadoc5011Record` (`core/backend/lib/monetarie/schemas/regulatory/cadoc5011/cadoc5011_record.ex:37`)
- Propósito: Registros do CADOC 5011 (estrutura societária) enviado ao BACEN, com percentual de participação, tipo de acionista e de controle.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_date` :date; `cnpj_institution` :string; `shareholder_document` :string; `shareholder_name` :string; `ownership_pct` :decimal; `voting_pct` :decimal; `shareholder_type` :string; `control_type` :string; `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [reference_date]; index [regulatory_file_id]; index [shareholder_document]; index [status]; unique [reference_date, cnpj_institution, shareholder_document]

### `cadoc_audit_logs`
- Módulo: `Monetarie.Schemas.Cadoc.CadocAuditLog` (`core/backend/lib/monetarie/schemas/cadoc/cadoc_audit_log.ex:63`)
- Propósito: Log de auditoria permanente de todas as submissões CADOC ao BACEN (4010, 4016, 4111, 2060/2061, 3040 e outros).
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `cadoc_type` :string; `event_type` :string; `submission_id` :binary_id; `reference_date` :date; `actor` :string (default: "system"); `file_name` :string; `file_hash` :string; `record_count` :integer; `total_amount_cents` :integer; `error_message` :string; `metadata` :map (default: %{}); `occurred_at` :utc_datetime
- Índices/chaves: index [:cadoc_type, :occurred_at]; index [:submission_id]; index [:event_type, :occurred_at]; index [:occurred_at]

### `cadoc_submissions`
- Módulo: `Monetarie.Schemas.Cadoc.Submission` (`core/backend/lib/monetarie/schemas/cadoc/submission.ex:7`)
- Propósito: Controla o envio de arquivos CADOC ao BACEN, com tipo, data de referência, status e confirmação de recebimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `cadoc_type` :string; `reference_date` :date; `period_type` :string; `status` :string (default: "pending"); `file_name` :string; `file_path` :string; `file_hash` :string; `record_count` :integer (default: 0); `total_amount_cents` :integer; `submitted_at` :utc_datetime; `confirmed_at` :utc_datetime; `rejected_at` :utc_datetime; `rejection_reason` :string; `submitted_by` :string; `metadata` :map (default: %{}); `sta_file_id` :string; `sta_protocol` :string; `sta_request_id` :string; `sta_last_sync_at` :utc_datetime
- Índices/chaves: index [:sta_file_id]; index [:status, :submitted_at]

### `cadoc_validation_results`
- Módulo: `Monetarie.Schemas.Cadoc.ValidationResult` (`core/backend/lib/monetarie/schemas/cadoc/validation_result.ex:10`)
- Propósito: Resultados de validação de regras aplicadas aos dados de um documento CADOC antes do envio ao BACEN.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `rule_code` :string; `rule_name` :string; `status` :string; `details` :string; `accounts_involved` {:array, :string} (default: []); `submission_id` belongs_to `Submission`
- Índices/chaves: index [:submission_id]; index [:status]; index [:rule_code]

### `cadoc_validation_rules`
- Módulo: `Monetarie.Schemas.Cadoc.ValidationRule` (`core/backend/lib/monetarie/schemas/cadoc/validation_rule.ex:8`)
- Propósito: Regras de validação aplicadas aos documentos CADOC enviados ao BACEN, com fórmula de cálculo, severidade e verificação automática.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `code` :string; `name` :string; `description` :string; `formula` :string; `severity` :string (default: "error"); `applies_to_documents` {:array, :string} (default: []); `auto_check` :boolean (default: false); `is_active` :boolean (default: true)
- Índices/chaves: unique [:code]; index [:is_active]

### `ccs_audit_logs`
- Módulo: `Monetarie.Schemas.Cadoc.CCSAuditLog` (`core/backend/lib/monetarie/schemas/cadoc/ccs_audit_log.ex:13`)
- Propósito: Log de auditoria persistente dos eventos do CCS (Cadastro de Clientes do Sistema Financeiro Nacional), com payload e status de processamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `message_id` :binary_id; `account_id` :binary_id; `cpf_cnpj` :string; `xml_hash` :string; `status` :string (default: "pending"); `error_message` :string; `request_payload` :map; `response_payload` :map; `processed_at` :utc_datetime
- Índices/chaves: index [:event_type]; index [:message_id]; index [:status]; index [:inserted_at]

### `ccs_files`
- Módulo: `Monetarie.Schemas.Regulatory.Ccs.Accs001File` (`core/backend/lib/monetarie/schemas/regulatory/ccs/accs001_file.ex:30`)
- Propósito: Arquivo ACCS001 em XML enviado ao BACEN com a atualização diária do Cadastro de Clientes do SFN (CCS).
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `tp_op_ccs` :string; `qualifdr_op_ccs` :string (default: "N"); `tp_pessoa` :string; `cpf_cnpj` :string; `dt_ini` :date; `dt_fim` :date; `num_remessa` :string; `dt_movto` :date; `file_name` :string; `file_content` :string; `file_size` :integer; `file_hash` :string; `status` :string (default: "generated"); `submitted_at` :utc_datetime; `confirmed_at` :utc_datetime; `rejected_at` :utc_datetime; `rejection_reason` :string; `sta_file_id` :string; `sta_request_id` :string; `sta_protocol` :string; `sta_last_sync_at` :utc_datetime; `total_operations` :integer (default: 1); `accs002_content` :string; `accs002_received_at` :utc_datetime; `error_code` :string; `accs003_content` :string; `accs003_received_at` :utc_datetime; `total_validated_records` :integer; `total_rejected_records` :integer; `accs009_content` :string; `accs009_received_at` :utc_datetime; `total_occurrences` :integer; `generated_by_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [:sta_file_id]

### `ccs_records`
- Módulo: `Monetarie.Schemas.Regulatory.Ccs.CcsRecord` (`core/backend/lib/monetarie/schemas/regulatory/ccs/ccs_record.ex:38`)
- Propósito: Registros do CCS, Cadastro de Clientes do SFN, enviados ao BACEN, com dados do titular, conta e status de confirmação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `document_type` :string; `document_number` :string; `holder_name` :string; `account_type` :string; `agency` :string; `account_number` :string; `start_date` :date; `end_date` :date; `status` :string (default: "active"); `last_synced_at` :utc_datetime_usec; `bcb_confirmed` :boolean (default: false); `account_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [account_id]; index [document_number]; index [status]; unique [document_number, account_type, agency, account_number]

### `ccs_snapshots`
- Módulo: `Monetarie.Schemas.Regulatory.Ccs.Accs004Snapshot` (`core/backend/lib/monetarie/schemas/regulatory/ccs/accs004_snapshot.ex:37`)
- Propósito: Arquivo ACCS004 (XML do BACEN) com o snapshot da posição de cadastro de clientes no CCS, por remessa e data-movimento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `file_name` :string; `num_remessa` :string; `identd_emissor` :string; `identd_destinatario` :string; `dt_movto` :date; `dt_hr_bc` :utc_datetime; `total_records` :integer (default: 0); `conglomerado_cnpjs` :map (default: %{}); `persons` :map (default: %{}); `content` :string; `file_size` :integer; `file_hash` :string; `received_at` :utc_datetime; `metadata` :map (default: %{})

### `compulsory_deposits`
- Módulo: `Monetarie.Schemas.Regulatory.CompulsoryDeposit` (`core/backend/lib/monetarie/schemas/regulatory/compulsory_deposit.ex:21`)
- Propósito: Depósitos compulsórios recolhidos ao Banco Central conforme regras do CMN/BACEN, com base de cálculo, alíquota e valor.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `deposit_type` :string; `reference_date` :date; `base_amount_cents` :integer; `rate_bps` :integer; `deposit_amount_cents` :integer; `status` :string (default: "calculated")

### `cosif_account_mappings`
- Módulo: `Monetarie.Schemas.Cadoc.CosifMapping` (`core/backend/lib/monetarie/schemas/cadoc/cosif_mapping.ex:7`)
- Propósito: Mapeia contas contábeis internas para o plano de contas COSIF do BACEN, com tipo de mapeamento e fórmula de cálculo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `internal_account_code` :string; `internal_account_name` :string; `cosif_code` :string; `cosif_name` :string; `cosif_level` :integer; `mapping_type` :string (default: "direct"); `formula` :string; `active` :boolean (default: true)

### `cql_queries`
- Módulo: `Monetarie.Schemas.CQL.Query` (`core/backend/lib/monetarie/schemas/cql/query.ex:18`)
- Propósito: Consultas qualificadas submetidas ao serviço do BACEN (CQL) para verificação de crédito, compliance, restrição judicial ou fiscal de documentos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `query_type` :string; `target_document` :string; `target_document_type` :string (default: "CPF"); `status` :string (default: "PENDING"); `result_data` :map (default: %{}); `bcb_protocol` :string; `requester_ispb` :string; `batch_id` :binary_id; `error_message` :string; `processed_at` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [batch_id]; index [bcb_protocol]; index [query_type]; index [status]; index [target_document]; FK `batch_id` → `cql_query_batches`

### `cql_query_batches`
- Módulo: `Monetarie.Schemas.CQL.QueryBatch` (`core/backend/lib/monetarie/schemas/cql/query_batch.ex:16`)
- Propósito: Agrupa múltiplas consultas qualificadas em lote solicitadas por outra instituição via ISPB, com contagem de sucesso e falha.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `batch_reference` :string; `query_count` :integer (default: 0); `completed_count` :integer (default: 0); `failed_count` :integer (default: 0); `status` :string (default: "CREATED"); `submitted_at` :utc_datetime_usec; `completed_at` :utc_datetime_usec; `requester_ispb` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [batch_reference]; index [status]

### `declaration_schedules`
- Módulo: `Monetarie.Schemas.Regulatory.DeclarationSchedule` (`core/backend/lib/monetarie/schemas/regulatory/declaration_schedule.ex:20`)
- Propósito: Controle de prazos e status de entrega de declarações regulatórias, com tipo, período de referência e protocolo de aceite.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `declaration_type` Ecto.Enum; `name` :string; `reference_period` :string; `deadline` :date; `status` Ecto.Enum; `submitted_at` :utc_datetime_usec; `accepted_at` :utc_datetime_usec; `protocol_number` :string; `notes` :string; `metadata` :map (default: %{}); `regulatory_file_id` belongs_to `Monetarie.Schemas.Regulatory.RegulatoryFile`; `responsible_id` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [deadline]; unique [declaration_type, reference_period]; index [status]; FK `regulatory_file_id` → `regulatory_files`; FK `responsible_id` → `users`

### `dere_atividade`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.Atividade` (`core/backend/lib/monetarie/schemas/regulatory/dere/atividade.ex:14`)
- Propósito: Catálogo de códigos de atividades de serviços financeiros (Tabela 21) usado na declaração DeRE enviada à Receita Federal.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `codigo` :string; `descricao` :string; `versao_tabela` :string; `ativo` :boolean (default: true)

### `dere_certificado`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.Certificado` (`core/backend/lib/monetarie/schemas/regulatory/dere/certificado.ex:18`)
- Propósito: Certificado digital e-CNPJ A1 usado na DeRE, armazenado de forma criptografada por CNPJ raiz, com validade e histórico de upload.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `nr_insc` :string; `cert_ecnpj_encrypted` :binary; `cert_ecnpj_password_encrypted` :binary; `cert_ecnpj_thumbprint` :string; `cert_ecnpj_subject_cnpj` :string; `cert_ecnpj_emitido_em` :date; `cert_ecnpj_valido_ate` :date; `cert_ecnpj_uploaded_at` :utc_datetime_usec; `cert_ecnpj_uploaded_by` :binary_id; `cert_ecnpj_alert_last_sent_at` :utc_datetime_usec; `ativo` :boolean (default: true)
- Índices/chaves: unique [:nr_insc]; index [:cert_ecnpj_valido_ate]

### `dere_codtrib`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.CodTrib` (`core/backend/lib/monetarie/schemas/regulatory/dere/cod_trib.ex:17`)
- Propósito: Catálogo dos códigos de tributação (codTrib, Tabela 11) usados na Declaração de Repasse de Emolumentos (DeRE).
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `codigo` :string; `titulo` :string; `descricao` :string; `dispositivo_legal` :string; `bloco` :string; `versao_tabela` :string; `ativo` :boolean (default: true)

### `dere_evento`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.Evento` (`core/backend/lib/monetarie/schemas/regulatory/dere/evento.ex:17`)
- Propósito: Evento da DeRE (Declaração de Regimes Específicos da Reforma Tributária IBS/CBS), tipo D-1001/D-1011, com ciclo de vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `id_evento` :string; `tipo` :string; `tp_oper` :integer; `status` :string (default: "gerado"); `ciclo_vida` :string (default: "ATIVO"); `nr_insc` :string; `ini_valid` :date; `fim_valid` :date; `versao_tabela` :string; `xml_fragment` :string; `checksum` :string; `mot_excl` :integer; `nr_proc` :string; `nr_recibo` :string; `dh_recibo` :utc_datetime

### `dere_lote_envio`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.LoteEnvio` (`core/backend/lib/monetarie/schemas/regulatory/dere/lote_envio.ex:24`)
- Propósito: Lote de envio da declaração DeRE à Receita Federal, agrupando até 50 eventos, com status de aceite/rejeição e XMLs de transmissão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `nr_insc` :string; `protocolo` :string; `status` :string (default: "montado"); `cd_resposta` :integer; `desc_resposta` :string; `evento_ids` {:array, :binary_id} (default: []); `qtd_eventos` :integer (default: 0); `envio_xml` :string; `retorno_xml` :string; `ocorrencias` :map (default: %{}); `dh_envio` :utc_datetime; `dh_retorno` :utc_datetime; `tentativas_consulta` :integer (default: 0)
- Índices/chaves: unique [:protocolo]; index [:status]

### `dere_mapping_rule`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.MappingRule` (`core/backend/lib/monetarie/schemas/regulatory/dere/mapping_rule.ex:22`)
- Propósito: Regras de-para da DeRE que convertem padrões de código COSIF em código tributário de 9 dígitos, com prioridade de aplicação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `padrao_cosif` :string; `match_category` :string; `nivel_min` :integer; `nivel_max` :integer; `codtrib_codigo` :string; `prioridade` :integer (default: 100); `descricao` :string; `versao_tabela` :string; `ativo` :boolean (default: true)

### `dere_pgcc_conta`
- Módulo: `Monetarie.Schemas.Regulatory.Dere.PgccConta` (`core/backend/lib/monetarie/schemas/regulatory/dere/pgcc_conta.ex:33`)
- Propósito: Plano Geral de Contas Contábeis (PGCC) da DeRE, uma linha por conta COSIF com código de tributação sugerido e final.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `cosif_code` :string; `nome_cta` :string; `ind_cta` :string; `cod_nat` :integer; `nat_cta` :string; `nivel_cta` :integer; `c_cta_ref` :string; `codtrib_sugerido` :string; `regra_origem_id` :binary_id; `codtrib_final` :string; `status` :string (default: "sugerido"); `ind_trib_iss` :integer; `versao_tabela` :string; `ini_vig` :date; `fim_vig` :date

### `dimp_records`
- Módulo: `Monetarie.Schemas.Regulatory.Dimp.DimpRecord` (`core/backend/lib/monetarie/schemas/regulatory/dimp/dimp_record.ex:40`)
- Propósito: Registros da DIMP (Declaração de Informações de Meios de Pagamento) por UF, tipo de operação, contagem e valor total.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_month` :date; `uf` :string; `operation_type` :string; `transaction_count` :integer (default: 0); `total_amount` :integer (default: 0); `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [reference_month]; index [regulatory_file_id]; index [status]; index [uf]; unique [reference_month, uf, operation_type]

### `drsac_records`
- Módulo: `Monetarie.Schemas.Regulatory.Drsac.DrsacRecord` (`core/backend/lib/monetarie/schemas/regulatory/drsac/drsac_record.ex:39`)
- Propósito: Registros do CADOC 2030 (DRSAC), demonstrativo de risco com eventos de perda e recuperação por categoria e status de resolução.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_date` :date; `cnpj` :string; `risk_category` :string; `event_type` :string; `occurrence_date` :date; `loss_amount` :integer (default: 0); `recovery_amount` :integer (default: 0); `resolution_status` :string (default: "open"); `description` :string; `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [reference_date]; index [regulatory_file_id]; index [resolution_status]; index [risk_category]; index [status]

### `efinanceira_contas`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Conta` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/conta.ex:55`)
- Propósito: Contas financeiras reportadas semestralmente no evento evtMovOpFin da e-Financeira, com tipo de conta, titulares e datas de abertura e encerramento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `conta_interna_id` :integer; `num_conta` :string; `tp_num_conta` :string; `tp_conta` :integer; `sub_tp_conta` :integer; `moeda` :string (default: "BRL"); `data_abertura` :date; `data_encerramento` :date; `no_titulares` :integer (default: 1); `tp_relacao_declarado` :string; `ind_inatividade` :boolean (default: false); `intermediario_cnpj` :string; `fundo_cnpj` :string; `declarante_id` belongs_to `Declarante`; `declarado_id` belongs_to `Declarado`; `periodo_id` belongs_to `Periodo`
- Índices/chaves: unique [:declarante_id, :declarado_id, :num_conta, :periodo_id]; index [:conta_interna_id]; index [:tp_conta]

### `efinanceira_declarados`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Declarado` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/declarado.ex:81`)
- Propósito: Pessoas físicas ou jurídicas declaradas na e-Financeira, com identificador fiscal, nome, país de residência e endereço.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tp_ni` :integer; `ni_declarado` EFinanceiraEncryptedDocument; `ni_declarado_hash` :binary; `nome_declarado` EFinanceiraEncryptedDocument; `nome_declarado_hash` :binary; `pais_residencia` :string (default: "BR"); `tp_declarado` :string; `nfe_passiva` :boolean (default: false); `ind_inatividade` :boolean (default: false); `ind_n_doc` :boolean (default: false); `data_nascimento` EFinanceiraEncryptedDate; `endereco` EFinanceiraEncryptedMap; `cliente_user_id` :integer; `declarante_id` belongs_to `Declarante`
- Índices/chaves: unique [:declarante_id, :tp_ni, :ni_declarado]; index [:pais_residencia]; index [:tp_declarado]; index [:cliente_user_id]; unique [:declarante_id, :tp_ni, :ni_declarado_hash]; index [:nome_declarado_hash]

### `efinanceira_declarantes`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Declarante` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/declarante.ex:39`)
- Propósito: Declarante da e-Financeira, CNPJ da cooperativa obrigada a entregar informações à Receita Federal conforme a IN RFB 1.571/2015.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `cnpj` EFinanceiraEncryptedDocument; `cnpj_hash` :binary; `giin` :string; `razao_social` :string; `nome_fantasia` EFinanceiraEncryptedDocument; `nome_fantasia_hash` :binary; `responsavel_cpf` EFinanceiraEncryptedDocument; `responsavel_cpf_hash` :binary; `responsavel_nome` :string; `responsavel_email` EFinanceiraEncryptedDocument; `responsavel_telefone` EFinanceiraEncryptedDocument; `responsavel_setor` :string; `categoria_fatca` EFinanceiraEncryptedDocument; `ativo` :boolean (default: true); `fonte_dados` :string (default: "core"); `cert_ecnpj_encrypted` :binary; `cert_ecnpj_password_encrypted` :binary; `cert_ecnpj_thumbprint` :string; `cert_ecnpj_subject_cnpj` :string; `cert_ecnpj_emitido_em` :date; `cert_ecnpj_valido_ate` :date; `cert_ecnpj_uploaded_at` :utc_datetime_usec; `cert_ecnpj_alert_last_sent_at` :utc_datetime_usec; `entity_id` belongs_to `Monetarie.Schemas.Entities.Entity`
- Índices/chaves: unique [:cnpj]; index [:entity_id]; index [:ativo]; unique [:cnpj_hash]; index [:responsavel_cpf_hash]; index [:nome_fantasia_hash]; index [:cert_ecnpj_valido_ate]

### `efinanceira_eventos`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Evento` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/evento.ex:98`)
- Propósito: Evento individual da e-Financeira (cadastro, abertura, movimento etc.), com XML assinado, hash, número de recibo e ciclo de vida.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tipo_evento` :string; `namespace` :string; `id_evento` :string; `ind_retificacao` :integer (default: 1); `nr_recibo_original` :string; `xml_original` :string; `xml_assinado` :string; `xml_hash` :string; `status` :string (default: "rascunho"); `ciclo_vida` :string (default: "ATIVO"); `nr_recibo` :string; `referencia_id` Ecto.UUID; `referencia_tipo` :string; `declarante_id` belongs_to `Declarante`; `periodo_id` belongs_to `Periodo`; `lote_id` belongs_to `Lote`; `evento_relacionado_id` belongs_to `__MODULE__`
- Índices/chaves: unique [:id_evento]; index [:declarante_id, :tipo_evento, :status]; index [:lote_id]; index [:ciclo_vida]; index [:nr_recibo]

### `efinanceira_lote_envios`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.LoteEnvio` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/lote_envio.ex:44`)
- Propósito: Auditoria do envio de lotes da e-Financeira à Receita Federal, com protocolo, código de resposta e ocorrências.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `lote_seq` :integer; `lote_filename` :string; `lote_xml_cripto` :string; `tipo` :string (default: "movimentos"); `evento_ids` {:array, :string} (default: []); `evento_declarado_ids` {:array, :string} (default: []); `protocolo` :string; `cd_resposta_atual` :integer; `desc_resposta` :string; `retorno_xml` :string; `ocorrencias` :map (default: %{}); `status` :string (default: "pendente"); `tentativas` :integer (default: 0); `ultima_consulta_em` :utc_datetime_usec; `erro_msg` :string; `periodo_id` belongs_to `Periodo`
- Índices/chaves: index [:periodo_id]; unique [:periodo_id, :lote_seq]; unique [:protocolo]; index [:periodo_id, :tipo]

### `efinanceira_lotes`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Lote` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/lote.ex:69`)
- Propósito: Lotes de até 50 eventos da e-Financeira enviados via REST assíncrono à Receita Federal, com protocolo, XML assinado e status.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tp_amb` :integer; `numero_protocolo` :string; `cd_resposta` :integer; `http_status` :integer; `xml_lote` :string; `xml_lote_assinado` :string; `xml_lote_criptografado` :string; `retorno_xml` :string; `gzip` :boolean (default: false); `enviado_em` :utc_datetime_usec; `ultimo_polling_em` :utc_datetime_usec; `status` :string (default: "rascunho"); `declarante_id` belongs_to `Declarante`
- Índices/chaves: unique [:numero_protocolo]; index [:declarante_id, :status]; index [:enviado_em]

### `efinanceira_movimentos`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Movimento` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/movimento.ex:47`)
- Propósito: Movimentação financeira mensal por conta reportada na e-Financeira, com totais de créditos, débitos e saldo do último dia do mês.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `ano_mes_caixa` :string; `tot_creditos` EFinanceiraEncryptedMoney (default: Decimal.new(0); `tot_debitos` EFinanceiraEncryptedMoney (default: Decimal.new(0); `tot_creditos_mesma_titularidade` EFinanceiraEncryptedMoney (default: Decimal.new(0); `tot_debitos_mesma_titularidade` EFinanceiraEncryptedMoney (default: Decimal.new(0); `vlr_ult_dia` EFinanceiraEncryptedMoney (default: Decimal.new(0); `reportavel` :boolean (default: false); `motivo_reportavel` :string; `conta_id` belongs_to `Conta`
- Índices/chaves: unique [:conta_id, :ano_mes_caixa]; index [:reportavel]; index [:ano_mes_caixa]

### `efinanceira_nifs`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Nif` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/nif.ex:33`)
- Propósito: Números de Identificação Fiscal (NIF) de residência fiscal estrangeira do declarado, para fins de e-Financeira e CRS.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `numero_nif` :string; `pais_emissao` :string; `motivo_ausencia` :string; `declarado_id` belongs_to `Declarado`
- Índices/chaves: unique [:declarado_id, :pais_emissao]; index [:numero_nif]

### `efinanceira_overrides`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Override` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/override.ex:20`)
- Propósito: Correções manuais aplicadas a campos declarados da e-Financeira, de conta ou movimento, com valor corrigido, valor base e motivo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `target_type` :string; `target_locator` :map; `field` :string; `valor_corrigido` :string; `valor_base` :string; `status` :string (default: "ativo"); `motivo` :string; `declarante_id` belongs_to `Declarante`; `periodo_id` belongs_to `Periodo`; `created_by_admin_id` belongs_to `Admin`
- Índices/chaves: unique [:declarante_id, :periodo_id, :target_type, :target_locator, :field]; index [:periodo_id, :status]

### `efinanceira_periodo_transitions`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.PeriodoTransition` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/periodo_transition.ex:25`)
- Propósito: Log de auditoria imutável das transições de status de um período de apuração da e-Financeira.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `from_status` :string; `to_status` :string; `action_name` :string; `payload` :map; `remote_ip` :string; `user_agent` :string; `inserted_at` :utc_datetime_usec; `periodo_id` belongs_to `Periodo`; `by_admin_id` belongs_to `Admin`
- Índices/chaves: index [:periodo_id, :inserted_at]; index [:by_admin_id, :inserted_at]; index [:to_status, :inserted_at]

### `efinanceira_periodos`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Periodo` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/periodo.ex:87`)
- Propósito: Período semestral de apuração da e-Financeira por declarante, com prazo de entrega, abertura, fechamento e protocolo de recibo.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `ano` :integer; `semestre` :integer; `ano_semestre` :string; `status` :string (default: "rascunho"); `prazo_entrega` :date; `data_abertura` :utc_datetime_usec; `data_fechamento` :utc_datetime_usec; `sem_movimento` :boolean (default: false); `id_evt_abertura` :string; `id_evt_fechamento` :string; `enviado_em` :utc_datetime_usec; `recibo_protocolo` :string; `recibo_recebido_em` :utc_datetime_usec; `recibo_xml` :string; `recibo_resumo` :map; `last_operator_admin` :map; `tem_envio_rfb` :boolean (default: false); `declarante_id` belongs_to `Declarante`
- Índices/chaves: unique [:declarante_id, :ano, :semestre]; index [:status]; index [:prazo_entrega]; index [:recibo_protocolo]; index [:recibo_atual_id]

### `efinanceira_pgtos_acum`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.PgtoAcum` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/pgto_acum.ex:27`)
- Propósito: Pagamentos e rendimentos acumulados por tipo, reportados no evento de movimento da e-Financeira.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `tp_pgto` :string; `tot_pgtos_acum` :decimal; `movimento_id` belongs_to `Movimento`
- Índices/chaves: unique [:movimento_id, :tp_pgto]

### `efinanceira_recibos`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Recibo` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/recibo.ex:37`)
- Propósito: Histórico imutável de recibos de protocolo da Receita Federal para um período de declaração da e-Financeira.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `protocolo` :string; `resultado` :string; `recebido_em` :utc_datetime_usec; `xml` :string; `resumo` :map; `origem` :string (default: "manual"); `periodo_id` belongs_to `Periodo`; `imported_by_admin_id` belongs_to `Admin`
- Índices/chaves: index [:periodo_id, :recebido_em]; unique [:protocolo]

### `efinanceira_records`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceiraLegacy.EFinanceiraRecord` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira_legacy/efinanceira_record.ex:52`)
- Propósito: Registro legado (obsoleto) da e-Financeira, substituído pelo novo modelo de declarantes, contas, movimentos e eventos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_semester` :date; `document_type` :string; `document_number` :string; `holder_name` :string; `account_type` :string; `opening_balance` :integer (default: 0); `closing_balance` :integer (default: 0); `total_credits` :integer (default: 0); `total_debits` :integer (default: 0); `highest_balance` :integer (default: 0); `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [document_number]; index [reference_semester]; index [regulatory_file_id]; index [status]; FK `regulatory_file_id` → `regulatory_files`

### `efinanceira_snapshots`
- Módulo: `Monetarie.Schemas.Regulatory.EFinanceira.Snapshot` (`core/backend/lib/monetarie/schemas/regulatory/efinanceira/snapshot.ex:45`)
- Propósito: Snapshot pré-computado do movimento financeiro mensal por conta para a e-Financeira, com créditos, débitos e reportabilidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `ano_mes_caixa` :string; `tot_creditos` :decimal (default: Decimal.new(0); `tot_debitos` :decimal (default: Decimal.new(0); `tot_creditos_mesma_titularidade` :decimal (default: Decimal.new(0); `tot_debitos_mesma_titularidade` :decimal (default: Decimal.new(0); `vlr_ult_dia` :decimal (default: Decimal.new(0); `reportavel` :boolean (default: false); `motivo_reportavel` :string; `xml_fragment` :string (default: ""); `checksum` :string (default: ""); `status` :string (default: "stale"); `last_computed_at` :utc_datetime_usec; `declarante_id` belongs_to `Declarante`; `periodo_id` belongs_to `Periodo`; `declarado_id` belongs_to `Declarado`; `conta_id` belongs_to `Conta`
- Índices/chaves: unique [:declarante_id, :periodo_id, :declarado_id, :conta_id, :ano_mes_caixa]; index [:periodo_id, :status]; index [:periodo_id, :reportavel, :declarado_id]

### `fgcoop_coverage`
- Módulo: `Monetarie.Schemas.Regulatory.FGCoop.Coverage` (`core/backend/lib/monetarie/schemas/regulatory/fgcoop/coverage.ex:10`)
- Propósito: Acompanhamento da cobertura do FGCoop (Fundo Garantidor do Cooperativismo de Crédito) por depositante, com limite de R$ 250 mil.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`
- Colunas: `member_id` :binary_id; `total_deposits` :integer (default: 0); `coverage_limit` :integer (default: 25_000_000); `coverage_used` :integer (default: 0); `updated_at` :utc_datetime
- Índices/chaves: unique [member_id]; FK `member_id` → `cooperative_members`

### `iof_tables`
- Módulo: `Monetarie.Schemas.Regulatory.IofTable` (`core/backend/lib/monetarie/schemas/regulatory/iof_table.ex:29`)
- Propósito: Tabelas de alíquotas de IOF por tipo de operação financeira, com taxa diária, taxa adicional e data de vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `operation_type` :string; `daily_rate_bps` :decimal; `additional_rate_bps` :decimal; `effective_date` :date; `is_active` :boolean (default: true); `description` :string
- Índices/chaves: index [is_active]; unique [operation_type, effective_date]

### `irpf_records`
- Módulo: `Monetarie.Schemas.Regulatory.Irpf.IrpfRecord` (`core/backend/lib/monetarie/schemas/regulatory/irpf/irpf_record.ex:45`)
- Propósito: Registros do Informe de Rendimentos (IRPF) por titular, com saldos de início e fim de ano, juros e IOF.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_year` :integer; `document_type` :string; `document_number` :string; `holder_name` :string; `balance_jan1` :integer (default: 0); `balance_dec31` :integer (default: 0); `total_credits` :integer (default: 0); `total_debits` :integer (default: 0); `savings_income` :integer (default: 0); `credit_interest_paid` :integer (default: 0); `iof_charged` :integer (default: 0); `irrf_withheld` :integer (default: 0); `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{}); `account_id` belongs_to `Monetarie.Schemas.Relational.Account`
- Índices/chaves: index [document_number]; index [reference_year]; index [regulatory_file_id]; index [status]; unique [reference_year, document_number, account_id]; FK `account_id` → `accounts`

### `mcc_records`
- Módulo: `Monetarie.Schemas.Regulatory.Mcc.MccRecord` (`core/backend/lib/monetarie/schemas/regulatory/mcc/mcc_record.ex:51`)
- Propósito: Registros do MCC (Mapa de Composição de Capital), com componentes, valor de dedução e valor líquido por camada de capital.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_date` :date; `capital_tier` :string; `component_type` :string; `description` :string; `amount` :integer (default: 0); `deduction_amount` :integer (default: 0); `net_amount` :integer (default: 0); `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [capital_tier]; index [reference_date]; index [regulatory_file_id]; index [status]; unique [reference_date, capital_tier, component_type]

### `pgv_records` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Registros do módulo regulatório PGV criados no baseline, sem schema Ecto no código atual.
- Colunas: `id` uuid DEFAULT gen_random_uuid() NOT NULL; `reference_quarter` date NOT NULL; `payment_type` character varying(255) NOT NULL; `channel` character varying(255) NOT NULL; `value_range` character varying(255) NOT NULL; `transaction_count` integer DEFAULT 0 NOT NULL; `total_amount` bigint DEFAULT 0 NOT NULL; `average_amount` bigint DEFAULT 0 NOT NULL; `status` character varying(255) DEFAULT 'pending'::character varying NOT NULL; `regulatory_file_id` uuid; `metadata` jsonb DEFAULT '{}'::jsonb; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: index [payment_type]; index [reference_quarter]; index [status]

### `rc6_consents`
- Módulo: `Monetarie.Schemas.Regulatory.Rc6.Consent` (`core/backend/lib/monetarie/schemas/regulatory/rc6/consent.ex:12`)
- Propósito: Registro de consentimento de clientes para envio de dados ao Cadastro Positivo (RC6), com origem, canal e datas de concessão/revogação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `customer_document` :string; `customer_name` :string; `customer_type` :string (default: "unknown"); `consent_version` :string; `consent_text_hash` :string; `source` :string; `contract_id` :string; `channel` :string; `status` :string (default: "active"); `granted_at` :utc_datetime_usec; `revoked_at` :utc_datetime_usec; `revoked_by_id` Ecto.UUID; `evidence_ref` :string; `ip_address` :string; `user_agent` :string; `metadata` :map (default: %{})
- Índices/chaves: index [:entity_id]; index [:customer_document]; index [:status]; unique [:entity_id, :customer_document]

### `rc6_events`
- Módulo: `Monetarie.Schemas.Regulatory.Rc6.Event` (`core/backend/lib/monetarie/schemas/regulatory/rc6/event.ex:26`)
- Propósito: Trilha de eventos de consentimentos e indicações de fraude do Open Finance sob a Resolução Conjunta 6, incluindo declarações mensais.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `fraud_indication_id` Ecto.UUID; `consent_id` Ecto.UUID; `actor_id` Ecto.UUID; `event_type` :string; `occurred_at` :utc_datetime_usec; `reason` :string; `metadata` :map (default: %{})
- Índices/chaves: index [:entity_id]; index [:fraud_indication_id]; index [:consent_id]; index [:event_type]; index [:occurred_at]

### `rc6_evidences`
- Módulo: `Monetarie.Schemas.Regulatory.Rc6.Evidence` (`core/backend/lib/monetarie/schemas/regulatory/rc6/evidence.ex:22`)
- Propósito: Evidências (contratos, documentos, registros de transação) vinculadas a indícios de fraude compartilhados conforme a Resolução Conjunta nº 6.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `fraud_indication_id` Ecto.UUID; `consent_id` Ecto.UUID; `captured_by_id` Ecto.UUID; `evidence_type` :string; `title` :string; `description` :string; `external_ref` :string; `storage_path` :string; `file_hash` :string; `file_size` :integer; `content_type` :string; `captured_at` :utc_datetime_usec; `retention_until` :date; `status` :string (default: "active"); `metadata` :map (default: %{})
- Índices/chaves: index [:entity_id]; index [:fraud_indication_id]; index [:consent_id]; index [:evidence_type]; index [:retention_until]; index [:status]

### `rc6_fraud_indications`
- Módulo: `Monetarie.Schemas.Regulatory.Rc6.FraudIndication` (`core/backend/lib/monetarie/schemas/regulatory/rc6/fraud_indication.ex:25`)
- Propósito: Indicações de fraude do RC6 (Open Finance) vinculadas a consentimento, com dados do fraudador, do cliente e status da apuração.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `consent_id` Ecto.UUID; `indication_reference` :string; `status` :string (default: "registered"); `fraud_type` :string; `customer_document` :string; `customer_name` :string; `customer_type` :string (default: "unknown"); `fraudster_document` :string; `fraudster_name` :string; `description` :string; `registering_institution_cnpj` :string; `registering_institution_name` :string; `recipient_document` :string; `recipient_name` :string; `recipient_ispb` :string; `recipient_bank_code` :string; `recipient_branch` :string; `recipient_account_number` :string; `recipient_account_type` :string; `recipient_pix_key` :string; `source_event_type` :string; `source_event_id` :string; `occurred_at` :utc_datetime_usec; `detected_at` :utc_datetime_usec; `registered_at` :utc_datetime_usec; `sharing_deadline_at` :utc_datetime_usec; `cancellation_reason` :string; `cancelled_at` :utc_datetime_usec; `cancelled_by_id` Ecto.UUID; `shared_at` :utc_datetime_usec; `shared_by_id` Ecto.UUID; `share_reference` :string; `retention_until` :date; `corrected_at` :utc_datetime_usec; `corrected_by_id` Ecto.UUID; `correction_reason` :string; `excluded_at` :utc_datetime_usec; `excluded_by_id` Ecto.UUID; `exclusion_reason` :string; `is_ld_ft_related` :boolean (default: false); `metadata` :map (default: %{})
- Índices/chaves: index [:entity_id]; index [:customer_document]; index [:fraudster_document]; index [:recipient_document]; index [:status]; index [:sharing_deadline_at]; index [:shared_at]; index [:retention_until]; index [:excluded_at]; unique [:entity_id, :indication_reference]

### `rc6_monthly_declarations`
- Módulo: `Monetarie.Schemas.Regulatory.Rc6.MonthlyDeclaration` (`core/backend/lib/monetarie/schemas/regulatory/rc6/monthly_declaration.ex:11`)
- Propósito: Declaração mensal ao Cadastro Positivo (layout RC6) com quantidade de inclusões, retificações, cancelamentos e exclusões de registros.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `reference_month` :date; `period_start` :date; `period_end` :date; `declaration_type` :string; `status` :string (default: "generated"); `indication_count` :integer (default: 0); `amended_count` :integer (default: 0); `cancelled_count` :integer (default: 0); `excluded_count` :integer (default: 0); `file_name` :string; `file_size` :integer; `file_hash` :string; `content` :string; `generated_at` :utc_datetime_usec; `generated_by_id` Ecto.UUID; `submitted_at` :utc_datetime_usec; `submitted_by_id` Ecto.UUID; `protocol` :string; `accepted_at` :utc_datetime_usec; `rejected_at` :utc_datetime_usec; `rejection_reason` :string; `metadata` :map (default: %{})
- Índices/chaves: index [:entity_id]; index [:reference_month]; index [:status]; unique [:entity_id, :reference_month]

### `registrato_records`
- Módulo: `Monetarie.Schemas.Regulatory.Registrato.RegistratoRecord` (`core/backend/lib/monetarie/schemas/regulatory/registrato/registrato_record.ex:34`)
- Propósito: Registros do Registrato, cadastro centralizado do BACEN de relacionamentos bancários, contas e chaves PIX dos clientes.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `member_id` :binary_id; `member_document` :string; `member_name` :string; `member_number` :string; `account_number` :string; `account_type` :string; `relationship_start` :date; `relationship_end` :date; `has_balance` :boolean (default: false); `last_transaction_date` :date; `pix_keys_count` :integer (default: 0); `sync_status` :string (default: "pending"); `last_synced_at` :utc_datetime; `regulatory_file_id` :binary_id; `status` :string (default: "pending"); `metadata` :map (default: %{})

### `regulatory_files`
- Módulo: `Monetarie.Schemas.Regulatory.RegulatoryFile` (`core/backend/lib/monetarie/schemas/regulatory/regulatory_file.ex:30`)
- Propósito: Arquivos regulatórios gerados para envio a órgãos reguladores, com tipo de relatório, período, status e protocolo de transmissão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `entity_id` Ecto.UUID; `report_type` :string; `reference_date` :date; `period_start` :date; `period_end` :date; `status` :string (default: "pending"); `file_name` :string; `file_size` :integer; `file_hash` :string; `record_count` :integer (default: 0); `content` :string; `sta_protocol` :string; `sta_delivered_at` :utc_datetime_usec; `bcb_ack_at` :utc_datetime_usec; `error_message` :string; `metadata` :map (default: %{})
- Índices/chaves: index [entity_id]; index [report_type, reference_date]; index [status]; unique [report_type, reference_date) WHERE ((period_start IS NULL) AND (period_end IS NULL) AND ((status)::text <> ALL ((ARRAY['failed'::character varying, 'generating'::character varying])::text[]))]; unique [report_type, reference_date, period_start, period_end) WHERE ((period_start IS NOT NULL) AND (period_end IS NOT NULL)]; FK `entity_id` → `entities`

### `scr_client_headers`
- Módulo: `Monetarie.Schemas.ScrEngine.ClientHeader` (`core/backend/lib/monetarie/schemas/scr_engine/client_header.ex:15`)
- Propósito: Cabeçalho pré-computado de dados do cliente para o CADOC 3040 do SCR, com total de vencimentos e quantidade de operações.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_month` :date; `document_number` :string; `data` :map (default: %{}); `xml_fragment` :string (default: ""); `total_vencimentos` :decimal (default: Decimal.new(0); `operation_count` :integer (default: 0)
- Índices/chaves: unique [:reference_month, :document_number]

### `scr_clients`
- Módulo: `Monetarie.Schemas.Regulatory.Scr.CreditClient` (`core/backend/lib/monetarie/schemas/regulatory/scr/credit_client.ex:20`)
- Propósito: Clientes de crédito reportados ao SCR (Sistema de Informações de Crédito do Banco Central), com rating e exposição total.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `document_type` :string; `document_number` :string; `client_name` :string; `client_type` :string; `economic_group_id` :binary_id; `risk_rating` :string; `total_exposure` :decimal; `metadata` :map (default: %{})
- Índices/chaves: unique [document_number]

### `scr_credit_operations`
- Módulo: `Monetarie.Schemas.Regulatory.Scr.CreditOperation` (`core/backend/lib/monetarie/schemas/regulatory/scr/credit_operation.ex:21`)
- Propósito: Operações de crédito reportadas ao SCR (Sistema de Informações de Créditos) do BACEN, com modalidade, saldo devedor e nível de provisionamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `contract_number` :string; `modality_code` :string; `sub_modality` :string; `contract_date` :date; `maturity_date` :date; `original_amount` :decimal; `outstanding_balance` :decimal; `provision_level` :string; `provision_amount` :decimal; `interest_rate` :decimal; `interest_type` :string; `indexer` :string; `guarantee_type` :string; `guarantee_value` :decimal; `overdue_days` :integer (default: 0); `overdue_amount` :decimal; `status` :string (default: "active"); `write_off_date` :date; `write_off_amount` :decimal; `last_payment_date` :date; `next_payment_date` :date; `installment_count` :integer; `remaining_installments` :integer; `stage` :integer (default: 1); `carteira` :string (default: "C5"); `metadata` :map (default: %{}); `client_id` belongs_to `Monetarie.Schemas.Regulatory.Scr.CreditClient`
- Índices/chaves: index [client_id]; index [contract_number]; index [modality_code]; index [provision_level]; index [status]; FK `client_id` → `scr_clients`

### `scr_events`
- Módulo: `Monetarie.Schemas.ScrEngine.Event` (`core/backend/lib/monetarie/schemas/scr_engine/event.ex:17`)
- Propósito: Trilha de auditoria append-only das alterações em snapshots do SCR, com diferença aplicada, origem e responsável pela mudança.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_month` :date; `event_type` :string; `document_number` :string; `contract_number` :string; `diff` :map; `source` :string; `performed_by` :binary_id
- Índices/chaves: index [:reference_month, :inserted_at]; index [:reference_month, :document_number]

### `scr_month_control`
- Módulo: `Monetarie.Schemas.ScrEngine.MonthControl` (`core/backend/lib/monetarie/schemas/scr_engine/month_control.ex:19`)
- Propósito: Controle do ciclo de vida mensal das remessas do SCR (CADOC 3040), com total de clientes, operações e reconciliação.
- Chave/particionamento: PK `{:reference_month, :date, autogenerate: false}`; timestamps (type: :utc_datetime)
- Colunas: `status` :string (default: "open"); `total_clients` :integer (default: 0); `total_operations` :integer (default: 0); `remessa` :integer (default: 1); `last_reconciled_at` :utc_datetime; `validation_result` :map (default: %{}); `generated_at` :utc_datetime; `file_hash` :string

### `scr_overrides`
- Módulo: `Monetarie.Schemas.ScrEngine.Override` (`core/backend/lib/monetarie/schemas/scr_engine/override.ex:19`)
- Propósito: Ajuste manual de valores de snapshot do SCR, registrando valor original, valor substituto, motivo e aprovação do ajuste.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_month` :date; `document_number` :string; `contract_number` :string; `field_name` :string; `original_value` :string; `override_value` :string; `reason` :string; `approved_by` :binary_id; `approved_at` :utc_datetime; `reverted_at` :utc_datetime; `reverted_by` :binary_id
- Índices/chaves: index [:reference_month, :document_number, :contract_number]

### `scr_snapshots`
- Módulo: `Monetarie.Schemas.ScrEngine.Snapshot` (`core/backend/lib/monetarie/schemas/scr_engine/snapshot.ex:17`)
- Propósito: Snapshot pré-computado de operações de crédito para geração do CADOC 3040 do SCR, com fragmento XML e checksum.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_month` :date; `document_number` :string; `contract_number` :string; `status` :string (default: "active"); `data` :map (default: %{}); `xml_fragment` :string (default: ""); `checksum` :string
- Índices/chaves: unique [:reference_month, :document_number, :contract_number]; index [:reference_month, :status]; index [:reference_month, :document_number]

### `scr_vencimentos`
- Módulo: `Monetarie.Schemas.Regulatory.Scr.ScrVencimento` (`core/backend/lib/monetarie/schemas/regulatory/scr/scr_vencimento.ex:11`)
- Propósito: Faixas de vencimento de crédito reportadas ao SCR, com modalidade, taxa anual, dias de atraso e valor de provisão.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `reference_date` :date; `document_number` :string; `contract_number` :string; `modality_code` :string; `origin_code` :string; `nature_code` :integer; `original_amount` :decimal; `emission_date` :date; `maturity_date` :date; `annual_rate` :decimal; `overdue_days` :integer (default: 0); `provision_amount` :decimal; `installment_count` :integer (default: 0); `installment_value` :decimal; `carteira` :string; `carac_especial` :string; `is_individualized` :boolean (default: true); `vencimento_code` :string; `vencimento_value` :decimal; `garantia_dominio` :string; `garantia_subdominio` :string; `perda_adicional` :decimal (default: 0); `perda_incorrida` :decimal (default: 0); `perda_interna` :decimal (default: 0)
- Índices/chaves: index [:reference_date]; index [:document_number]; index [:contract_number]; unique [:reference_date, :document_number, :contract_number, :vencimento_code]

### `simba_audit_logs`
- Módulo: `Monetarie.Schemas.Regulatory.Simba.AuditLog` (`core/backend/lib/monetarie/schemas/regulatory/simba/audit_log.ex:54`)
- Propósito: Trilha de auditoria do módulo SIMBA de prevenção a fraudes, com número do caso, tipo de evento e ator.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec, updated_at: false)
- Colunas: `case_number` :string; `event_type` :string; `actor_user_id` :binary_id; `payload` :map (default: %{}); `simba_case_id` belongs_to `Monetarie.Schemas.Regulatory.Simba.Case`
- Índices/chaves: index [:simba_case_id]; index [:case_number]; index [:event_type]; index [:inserted_at]

### `simba_cases`
- Módulo: `Monetarie.Schemas.Regulatory.Simba.Case` (`core/backend/lib/monetarie/schemas/regulatory/simba/case.ex:43`)
- Propósito: Casos do SIMBA (Sistema de Investigação de Movimentações Bancárias) com CPF/CNPJ do investigado criptografado, sob sigilo bancário da LC 105/2001.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `case_number` :string; `cpf_cnpj` Monetarie.Util.SimbaEncryptedDocument; `cpf_cnpj_hash` :binary; `period_start` :date; `period_end` :date; `notes` :string; `purged_at` :utc_datetime_usec; `regulatory_file_id` belongs_to `Monetarie.Schemas.Regulatory.RegulatoryFile`
- Índices/chaves: index [:cpf_cnpj_hash]; index [:case_number]; index [:period_end]; index [:purged_at]

### `sisbajud_audit_log`
- Módulo: `Monetarie.Schemas.Regulatory.SisbajudAuditLog` (`core/backend/lib/monetarie/schemas/regulatory/sisbajud_audit_log.ex:75`)
- Propósito: Log de auditoria das operações SISBAJUD, bloqueio e desbloqueio judicial de contas, do recebimento do arquivo até a confirmação ao BACEN.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `event_type` :string; `metadata` :map (default: %{}); `judicial_order_id` belongs_to `Monetarie.Schemas.Judicial.JudicialOrder`
- Índices/chaves: index [:judicial_order_id]; index [:event_type]; index [:inserted_at]

### `svr_records`
- Módulo: `Monetarie.Schemas.Regulatory.Svr.SvrRecord` (`core/backend/lib/monetarie/schemas/regulatory/svr/svr_record.ex:53`)
- Propósito: Registros do SVR, Sistema de Valores a Receber, com valores não procurados, prazo de expiração e status da reclamação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `reference_date` :date; `svr_type` :string; `customer_document` :string; `customer_name` :string; `customer_type` :string; `value_amount` :integer (default: 0); `value_type` :string; `origin_description` :string; `claim_status` :string (default: "unclaimed"); `claimed_at` :utc_datetime_usec; `expiry_date` :date; `status` :string (default: "pending"); `regulatory_file_id` :binary_id; `metadata` :map (default: %{})
- Índices/chaves: index [claim_status]; index [customer_document]; index [reference_date]; index [regulatory_file_id]; index [status]; index [svr_type]

## 15. Canais, cartões e serviços ao cliente

### `atm_terminals`
- Módulo: `Monetarie.Schemas.Atm.AtmTerminal` (`core/backend/lib/monetarie/schemas/atm/atm_terminal.ex:17`)
- Propósito: Cadastro de terminais de autoatendimento (ATM) com rede, localização, limites diários de saque e funcionalidades suportadas.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `terminal_id` :string; `name` :string; `network` Ecto.Enum; `location` :string; `address` :string; `city` :string; `state` :string; `status` Ecto.Enum; `daily_cash_limit_centavos` :integer (default: 5_000_000); `per_withdrawal_limit_centavos` :integer (default: 300_000); `supports_deposit` :boolean (default: false); `supports_balance` :boolean (default: true); `metadata` :map (default: %{}); `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [branch_id]; index [network]; index [status]; unique [terminal_id]; FK `branch_id` → `branches`

### `atm_transactions`
- Módulo: `Monetarie.Schemas.Atm.AtmTransaction` (`core/backend/lib/monetarie/schemas/atm/atm_transaction.ex:15`)
- Propósito: Registra transações realizadas em caixas eletrônicos, com tipo de operação, código de autorização, motivo de recusa e referência externa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `transaction_type` Ecto.Enum; `amount_centavos` :integer; `status` Ecto.Enum; `authorization_code` :string; `decline_reason` :string; `card_last_four` :string; `external_reference` :string; `metadata` :map (default: %{}); `terminal_id` belongs_to `Monetarie.Schemas.Atm.AtmTerminal`; `member_id` belongs_to `Monetarie.Schemas.Relational.User`; `account_id` belongs_to `Monetarie.Schemas.Relational.Account`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [account_id]; index [branch_id]; index [inserted_at]; index [member_id]; index [status]; index [terminal_id]; FK `account_id` → `accounts`; FK `branch_id` → `branches`; FK `member_id` → `users`; FK `terminal_id` → `atm_terminals`

### `card_authorization_records`
- Módulo: `Monetarie.Schemas.Cards.CardAuthorizationRecord` (`core/backend/lib/monetarie/schemas/cards/card_authorization_record.ex:19`)
- Propósito: Registros de autorização de transações de cartão, com valor, moeda, MCC, estabelecimento e motivo de negação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `valor` :integer; `moeda` :string (default: "BRL"); `mcc` :string; `merchant_name` :string; `merchant_city` :string; `merchant_country` :string (default: "BRA"); `tipo_transacao` :string; `resultado` :string; `motivo_negacao` :string; `codigo_autorizacao` :string; `timestamp_autorizacao` :utc_datetime_usec; `card_id` belongs_to `Monetarie.Schemas.Cards.Card`
- Índices/chaves: index [card_id]; index [resultado]; index [timestamp_autorizacao]; FK `card_id` → `cards`

### `card_chargebacks`
- Módulo: `Monetarie.Schemas.Cards.CardChargeback` (`core/backend/lib/monetarie/schemas/cards/card_chargeback.ex:19`)
- Propósito: Registros de chargeback e disputa de transações de cartão, com valor contestado, crédito provisório e prazo regulamentar de resposta.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `transaction_id` :binary_id; `account_id` :integer; `valor_disputa` :integer; `valor_credito_provisorio` :integer (default: 0); `motivo` :string; `codigo_motivo` :string; `descricao` :string; `evidencias` :map (default: %{}); `status` :string (default: "aberta"); `data_abertura` :utc_datetime_usec; `data_resolucao` :utc_datetime_usec; `prazo_resposta` :utc_datetime_usec; `card_id` belongs_to `Monetarie.Schemas.Cards.Card`
- Índices/chaves: index [card_id]; index [status]; index [transaction_id]; FK `card_id` → `cards`

### `card_invoices`
- Módulo: `Monetarie.Schemas.Cards.CardInvoice` (`core/backend/lib/monetarie/schemas/cards/card_invoice.ex:18`)
- Propósito: Faturas mensais de cartão de crédito, com datas de fechamento e vencimento, valor total, mínimo, juros rotativo, multa e IOF.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `account_id` :integer; `competencia` :date; `data_fechamento` :date; `data_vencimento` :date; `valor_total` :integer (default: 0); `valor_minimo` :integer; `valor_pago` :integer (default: 0); `juros_rotativo` :integer (default: 0); `multa` :integer (default: 0); `iof` :integer (default: 0); `status` :string (default: "aberta"); `card_id` belongs_to `Monetarie.Schemas.Cards.Card`
- Índices/chaves: index [account_id]; unique [card_id, competencia]; index [status]; FK `card_id` → `cards`

### `card_limits`
- Módulo: `Monetarie.Schemas.Cards.CardLimit` (`core/backend/lib/monetarie/schemas/cards/card_limit.ex:15`)
- Propósito: Define limites de gasto e saque por cartão, com tipo de limite, valor em centavos e situação ativa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `limit_type` Ecto.Enum; `amount_centavos` :integer; `active` :boolean (default: true); `card_id` belongs_to `Monetarie.Schemas.Cards.Card`
- Índices/chaves: unique [card_id, limit_type]; FK `card_id` → `cards`

### `card_transactions`
- Módulo: `Monetarie.Schemas.Cards.CardTransaction` (`core/backend/lib/monetarie/schemas/cards/card_transaction.ex:15`)
- Propósito: Transações de cartão (compras, saques, estornos e chargebacks), com valor original, moeda e status de liquidação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `transaction_type` Ecto.Enum; `amount_centavos` :integer; `currency` :string (default: "BRL"); `original_amount_centavos` :integer; `original_currency` :string; `merchant_name` :string; `merchant_category_code` :string; `status` Ecto.Enum; `authorization_code` :string; `decline_reason` :string; `processor_txn_id` :string; `settled_at` :utc_datetime_usec; `metadata` :map (default: %{}); `card_id` belongs_to `Monetarie.Schemas.Cards.Card`
- Índices/chaves: index [card_id]; index [inserted_at]; index [merchant_category_code]; index [operation_type]; index [status]; FK `card_id` → `cards`

### `cards`
- Módulo: `Monetarie.Schemas.Cards.Card` (`core/backend/lib/monetarie/schemas/cards/card.ex:15`)
- Propósito: Cadastro de cartões de pagamento (débito, crédito, pré-pago ou múltiplo), com bandeira, status e datas de ativação e bloqueio.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `card_type` Ecto.Enum; `brand` Ecto.Enum; `last_four` :string; `proxy_number` :string; `status` Ecto.Enum; `is_virtual` :boolean (default: false); `is_contactless` :boolean (default: true); `expiry_month` :integer; `expiry_year` :integer; `activated_at` :utc_datetime_usec; `blocked_at` :utc_datetime_usec; `cancelled_at` :utc_datetime_usec; `block_reason` :string; `cancellation_reason` :string; `processor_card_id` :string; `metadata` :map (default: %{}); `limite_total` :integer (default: 0); `limite_utilizado` :integer (default: 0); `limite_diario` :integer; `blocked_mccs` {:array, :string} (default: []); `uso_internacional` :boolean (default: false); `dia_vencimento` :integer (default: 10); `member_id` belongs_to `Monetarie.Schemas.Relational.User`; `account_id` belongs_to `Monetarie.Schemas.Relational.Account`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [account_id]; index [last_four]; index [member_id]; index [processor_card_id]; index [status]; FK `account_id` → `accounts`; FK `branch_id` → `branches`; FK `member_id` → `users`

## 16. Demais módulos (analytics, comunicação, corporativo, dados mestres)

### `alert_rules`
- Módulo: `Monetarie.Schemas.Alerts.AlertRule` (`core/backend/lib/monetarie/schemas/alerts/alert_rule.ex:29`)
- Propósito: Define regras de alerta operacional com condição, limite, janela de tempo, severidade e período de espera entre disparos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `type` :string; `condition` :string; `threshold` :integer; `window_seconds` :integer; `severity` :string; `enabled` :boolean (default: true); `cooldown_seconds` :integer (default: 300); `last_triggered_at` :utc_datetime_usec; `metadata` :map (default: %{})
- Índices/chaves: index [enabled]; index [type]

### `alerts`
- Módulo: `Monetarie.Schemas.Alerts.Alert` (`core/backend/lib/monetarie/schemas/alerts/alert.ex:44`)
- Propósito: Armazena alertas do sistema com tipo, severidade, status de reconhecimento e resolução, usados no monitoramento operacional.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `type` :string; `severity` :string; `title` :string; `description` :string; `source_system` :string; `status` :string (default: "open"); `acknowledged_by` :string; `acknowledged_at` :utc_datetime_usec; `resolved_by` :string; `resolved_at` :utc_datetime_usec; `auto_resolve` :boolean (default: false); `metadata` :map (default: %{})
- Índices/chaves: index [entity_id]; index [inserted_at]; index [severity]; index [source_system]; index [status]; index [status, severity]; index [type]; FK `entity_id` → `entities`

### `announcements`
- Módulo: `Monetarie.Schemas.Communications.Announcement` (`core/backend/lib/monetarie/schemas/communications/announcement.ex:8`)
- Propósito: Comunicados e avisos publicados para os usuários, com categoria, prioridade, público-alvo e período de vigência.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `title` :string; `body` :string; `category` Ecto.Enum; `priority` Ecto.Enum; `target_audience` Ecto.Enum; `published_at` :utc_datetime_usec; `expires_at` :utc_datetime_usec; `active` :boolean (default: true); `pinned` :boolean (default: false); `metadata` :map (default: %{}); `target_branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`; `created_by` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [active, published_at]; index [target_audience]; FK `created_by` → `users`; FK `target_branch_id` → `branches`

### `bank_registry`
- Módulo: `Monetarie.Schemas.BankRegistry` (`core/backend/lib/monetarie/schemas/bank_registry.ex:19`)
- Propósito: Cadastro de participantes do STR/SPB com código COMPE, ISPB, CNPJ e tipo de instituição financeira brasileira.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `compe_code` :string; `ispb` :string; `name` :string; `short_name` :string; `cnpj` :string; `institution_type` :string; `is_active` :boolean (default: true)
- Índices/chaves: unique [compe_code]; index [is_active]; unique [ispb]

### `banks`
- Módulo: `Monetarie.Schemas.Relational.Bank` (`core/backend/lib/monetarie/schemas/relational/bank.ex:7`)
- Propósito: Cadastro de instituições financeiras participantes do SFN, com código COMPE, código ISPB e nome da instituição.
- Chave/particionamento: PK `{:id, :integer, autogenerate: false}`
- Colunas: `code` :string; `ispb` :string; `name` :string
- Índices/chaves: unique [code]; unique [ispb]

### `batch_jobs`
- Módulo: `Monetarie.Schemas.Corporate.Support.BatchJob` (`core/backend/lib/monetarie/schemas/corporate/support/batch_job.ex:7`)
- Propósito: Definição e histórico de execução de rotinas em lote agendadas do sistema, com fila, resultado e contagem de erros.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `description` :string; `job_module` :string; `schedule` :string; `queue` :string (default: "default"); `status` Ecto.Enum; `last_run_at` :utc_datetime_usec; `last_result` :string; `last_error` :string; `run_count` :integer (default: 0); `error_count` :integer (default: 0); `metadata` :map (default: %{})
- Índices/chaves: unique [job_module]

### `campaign_recipients`
- Módulo: `Monetarie.Schemas.Communications.CampaignRecipient` (`core/backend/lib/monetarie/schemas/communications/campaign_recipient.ex:8`)
- Propósito: Destinatários de campanhas de comunicação (e-mail, SMS, push), rastreando status de envio, entrega e eventual erro.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `status` Ecto.Enum; `sent_at` :utc_datetime_usec; `delivered_at` :utc_datetime_usec; `error_message` :string; `metadata` :map (default: %{}); `campaign_id` belongs_to `Monetarie.Schemas.Communications.Campaign`; `member_id` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [campaign_id]; unique [campaign_id, member_id]; index [member_id]; FK `campaign_id` → `campaigns`; FK `member_id` → `users`

### `campaigns`
- Módulo: `Monetarie.Schemas.Communications.Campaign` (`core/backend/lib/monetarie/schemas/communications/campaign.ex:8`)
- Propósito: Campanhas de comunicação com clientes por canal, com critério de segmentação, agendamento e contagem de envios realizados.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `name` :string; `description` :string; `channel` Ecto.Enum; `status` Ecto.Enum; `template_subject` :string; `template_content` :string; `filter_criteria` :map (default: %{}); `scheduled_at` :utc_datetime_usec; `started_at` :utc_datetime_usec; `completed_at` :utc_datetime_usec; `target_count` :integer (default: 0); `sent_count` :integer (default: 0); `delivered_count` :integer (default: 0); `failed_count` :integer (default: 0); `metadata` :map (default: %{}); `created_by` belongs_to `Monetarie.Schemas.Relational.User`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [channel]; index [status]; FK `branch_id` → `branches`; FK `created_by` → `users`

### `complaint_actions`
- Módulo: `Monetarie.Schemas.Corporate.Ombudsman.ComplaintAction` (`core/backend/lib/monetarie/schemas/corporate/ombudsman/complaint_action.ex:8`)
- Propósito: Registra ações e mudanças de status no tratamento de reclamações da ouvidoria corporativa.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `action_type` Ecto.Enum; `description` :string; `from_status` :integer; `to_status` :integer; `metadata` :map (default: %{}); `complaint_id` belongs_to `Monetarie.Schemas.Corporate.Ombudsman.Complaint`; `performed_by` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [complaint_id]; FK `complaint_id` → `complaints`; FK `performed_by` → `users`

### `complaints`
- Módulo: `Monetarie.Schemas.Corporate.Ombudsman.Complaint` (`core/backend/lib/monetarie/schemas/corporate/ombudsman/complaint.ex:11`)
- Propósito: Registros de reclamações recebidas pela ouvidoria, com protocolo, canal, categoria, prazo e cumprimento de SLA, e resolução.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `protocol_number` :string; `channel` Ecto.Enum; `category` Ecto.Enum; `priority` Ecto.Enum; `status` Ecto.Enum; `subject` :string; `description` :string; `resolution` :string; `sla_deadline` :utc_datetime_usec; `sla_met` :boolean; `closed_at` :utc_datetime_usec; `metadata` :map (default: %{}); `member_id` belongs_to `Monetarie.Schemas.Relational.User`; `assigned_to` belongs_to `Monetarie.Schemas.Relational.User`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [assigned_to]; index [branch_id]; index [member_id]; index [priority]; unique [protocol_number]; index [sla_deadline]; index [status]; FK `assigned_to` → `users`; FK `branch_id` → `branches`; FK `member_id` → `users`

### `holidays`
- Módulo: `Monetarie.Schemas.Calendar.Holiday` (`core/backend/lib/monetarie/schemas/calendar/holiday.ex:29`)
- Propósito: Repositório de feriados nacionais, estaduais e municipais usado no cálculo de dias úteis em liquidações e vencimentos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime)
- Colunas: `date` :date; `name` :string; `scope` :string (default: "national"); `uf` :string; `municipality_ibge` :string; `source` :string (default: "manual"); `movable` :boolean (default: false); `active` :boolean (default: true)
- Índices/chaves: unique ["date", "scope", "coalesce(uf, '')", "coalesce(municipality_ibge, '')"]; index [:date]; index [:scope, :uf]; index [:scope, :municipality_ibge]

### `institution_directory` (sem schema Ecto)
- Origem: migration `priv/repo/migrations/20260706170000_create_institution_directory.exs`
- Propósito: Diretório de instituições financeiras (ISPB para nome), semeado a partir do SPB, usado para resolver o nome do banco em comprovantes.
- Colunas: `ispb` :string; `name` :string

### `insurance_claims`
- Módulo: `Monetarie.Schemas.Corporate.Insurance.InsuranceClaim` (`core/backend/lib/monetarie/schemas/corporate/insurance/insurance_claim.ex:8`)
- Propósito: Sinistros de seguros corporativos, com valor reclamado e aprovado, motivo de negativa e datas de análise e resolução.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `claim_number` :string; `claim_type` Ecto.Enum; `amount_claimed` :integer; `amount_approved` :integer; `status` Ecto.Enum; `description` :string; `denial_reason` :string; `submitted_at` :utc_datetime_usec; `reviewed_at` :utc_datetime_usec; `resolved_at` :utc_datetime_usec; `documents` {:array, :string} (default: []); `metadata` :map (default: %{}); `policy_id` belongs_to `Monetarie.Schemas.Corporate.Insurance.InsurancePolicy`; `reviewed_by` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: unique [claim_number]; index [policy_id]; index [status]; FK `policy_id` → `insurance_policies`; FK `reviewed_by` → `users`

### `insurance_policies`
- Módulo: `Monetarie.Schemas.Corporate.Insurance.InsurancePolicy` (`core/backend/lib/monetarie/schemas/corporate/insurance/insurance_policy.ex:8`)
- Propósito: Apólices de seguro corporativas, com número, prêmio, valor de cobertura, vigência e motivo de cancelamento.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `policy_number` :string; `status` Ecto.Enum; `premium_amount` :integer; `coverage_amount` :integer; `start_date` :date; `end_date` :date; `cancelled_at` :utc_datetime_usec; `cancellation_reason` :string; `metadata` :map (default: %{}); `product_id` belongs_to `Monetarie.Schemas.Corporate.Insurance.InsuranceProduct`; `member_id` belongs_to `Monetarie.Schemas.Relational.User`; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [branch_id]; index [loan_id]; index [member_id]; unique [policy_number]; index [product_id]; index [status]; FK `branch_id` → `branches`; FK `loan_id` → `loans`; FK `member_id` → `users`; FK `product_id` → `insurance_products`

### `insurance_products`
- Módulo: `Monetarie.Schemas.Corporate.Insurance.InsuranceProduct` (`core/backend/lib/monetarie/schemas/corporate/insurance/insurance_product.ex:9`)
- Propósito: Catálogo de produtos de seguro oferecidos, com seguradora parceira, tipo de cobertura, cálculo do prêmio e faixa etária elegível.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `code` :string; `name` :string; `description` :string; `insurer_name` :string; `insurer_cnpj` :string; `coverage_type` Ecto.Enum; `premium_calculation_type` Ecto.Enum; `base_premium_bps` :integer; `max_coverage_amount` :integer; `min_age` :integer (default: 18); `max_age` :integer (default: 75); `waiting_period_days` :integer (default: 30); `commission_rate_bps` :integer (default: 0); `active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [code]

### `kpi_definitions`
- Módulo: `Monetarie.Schemas.Analytics.KpiDefinition` (`core/backend/lib/monetarie/schemas/analytics/kpi_definition.ex:8`)
- Propósito: Catálogo de indicadores de desempenho (KPIs) do painel analítico, com unidade, categoria e limites de alerta e criticidade.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `code` :string; `name` :string; `description` :string; `category` Ecto.Enum; `unit` Ecto.Enum; `query_key` :string; `higher_is_better` :boolean (default: true); `warning_threshold` :integer; `critical_threshold` :integer; `active` :boolean (default: true); `metadata` :map (default: %{})
- Índices/chaves: unique [code]

### `kpi_snapshots`
- Módulo: `Monetarie.Schemas.Analytics.KpiSnapshot` (`core/backend/lib/monetarie/schemas/analytics/kpi_snapshot.ex:8`)
- Propósito: Instantâneos periódicos de indicadores chave (KPIs) de negócio, registrando valor atual, valor anterior e meta para análise histórica.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `period_date` :date; `value` :integer; `previous_value` :integer; `target_value` :integer; `metadata` :map (default: %{}); `kpi_id` belongs_to `Monetarie.Schemas.Analytics.KpiDefinition`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [period_date]; unique [kpi_id, period_date, branch_id]; FK `branch_id` → `branches`; FK `kpi_id` → `kpi_definitions`

### `master_data_currency_rates`
- Módulo: `Monetarie.Schemas.MasterData.CurrencyRate` (`core/backend/lib/monetarie/schemas/master_data/currency_rate.ex:40`)
- Propósito: Taxas de câmbio oficiais por moeda e data, usadas como dado mestre de referência cambial em outras operações.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `currency_code` :string; `currency_name` :string; `rate_date` :date; `buy_rate` :decimal; `sell_rate` :decimal; `parity_rate` :decimal; `source` :string; `is_official` :boolean (default: false); `metadata` :map (default: %{})
- Índices/chaves: index [currency_code]; unique [currency_code, rate_date, source]; index [is_official]; index [rate_date]

### `master_data_instruments`
- Módulo: `Monetarie.Schemas.MasterData.InstrumentRegistry` (`core/backend/lib/monetarie/schemas/master_data/instrument_registry.ex:49`)
- Propósito: Cadastro mestre de instrumentos financeiros (títulos, bonds, valores mobiliários) com ISIN, emissor, vencimento e taxa de cupom.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `isin` :string; `instrument_type` :string; `issuer` :string; `issuer_ispb` :string; `name` :string; `ticker` :string; `currency` :string (default: "BRL"); `face_value` :decimal; `issue_date` :date; `maturity_date` :date; `coupon_rate` :decimal; `index` :string; `spread` :decimal; `clearing` :string; `status` :string (default: "ACTIVE"); `custody_account` :string; `metadata` :map (default: %{})
- Índices/chaves: index [clearing]; index [instrument_type]; unique [isin]; index [issuer_ispb]; index [maturity_date]; index [status]

### `master_data_settlement_calendar`
- Módulo: `Monetarie.Schemas.MasterData.SettlementCalendar` (`core/backend/lib/monetarie/schemas/master_data/settlement_calendar.ex:45`)
- Propósito: Calendário de liquidação e compensação por câmara, como SELIC e CIP, com dias úteis, horários de abertura, fechamento e corte.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `clearing` :string; `date` :date; `is_business_day` :boolean; `grade` :string; `opening_time` :time; `closing_time` :time; `cutoff_time` :time; `description` :string; `metadata` :map (default: %{})
- Índices/chaves: unique [clearing, date]; index [clearing]; index [date]; index [is_business_day]

### `nfe_companies`
- Módulo: `Monetarie.Schemas.Nfe.NfeCompany` (`core/backend/lib/monetarie/schemas/nfe/nfe_company.ex:15`)
- Propósito: Empresas cadastradas na NFe.io para emissão de notas fiscais eletrônicas, com inscrição estadual, municipal e validade do certificado.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `nfe_io_id` :string; `name` :string; `cnpj` :string; `state_tax_id` :string; `city_tax_id` :string; `environment` Ecto.Enum (default: :sandbox); `certificate_expires_at` :utc_datetime_usec; `active` :boolean (default: true); `metadata` :map (default: %{}); `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: index [branch_id]; unique [cnpj]; unique [nfe_io_id]; FK `branch_id` → `branches`

### `nfe_events`
- Módulo: `Monetarie.Schemas.Nfe.NfeEvent` (`core/backend/lib/monetarie/schemas/nfe/nfe_event.ex:15`)
- Propósito: Eventos do ciclo de vida de notas fiscais eletrônicas (NFe), com tipo de evento e dados brutos.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `event_type` Ecto.Enum; `description` :string; `raw_data` :map (default: %{}); `nfe_invoice_id` belongs_to `Monetarie.Schemas.Nfe.NfeInvoice`; `performed_by` belongs_to `Monetarie.Schemas.Relational.User`
- Índices/chaves: index [event_type]; index [nfe_invoice_id]; FK `nfe_invoice_id` → `nfe_invoices`; FK `performed_by` → `users`

### `nfe_invoices`
- Módulo: `Monetarie.Schemas.Nfe.NfeInvoice` (`core/backend/lib/monetarie/schemas/nfe/nfe_invoice.ex:19`)
- Propósito: Notas fiscais eletrônicas (NFe) emitidas via integração com NFe.io, com chave de acesso, valor e destinatário.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `nfe_io_id` :string; `invoice_type` Ecto.Enum (default: :nfse); `number` :string; `series` :string; `access_key` :string; `status` Ecto.Enum; `amount_centavos` :integer; `tax_amount_centavos` :integer (default: 0); `description` :string; `recipient_name` :string; `recipient_document` :string; `recipient_type` Ecto.Enum (default: :cpf); `city_service_code` :string; `federal_service_code` :string; `cnae_code` :string; `issued_at` :utc_datetime_usec; `cancelled_at` :utc_datetime_usec; `pdf_url` :string; `xml_url` :string; `raw_response` :map (default: %{}); `metadata` :map (default: %{}); `nfe_company_id` belongs_to `Monetarie.Schemas.Nfe.NfeCompany`; `member_id` belongs_to `Monetarie.Schemas.Relational.User`; `loan_id` belongs_to `Monetarie.Schemas.Credit.Loan`; `branch_id` belongs_to `Monetarie.Schemas.Cooperative.Branch`
- Índices/chaves: unique [access_key) WHERE (access_key IS NOT NULL]; index [branch_id]; index [invoice_type]; index [issued_at]; index [member_id]; index [nfe_company_id]; index [nfe_io_id]; index [recipient_document]; index [status]; FK `branch_id` → `branches`; FK `loan_id` → `loans`; FK `member_id` → `users`; FK `nfe_company_id` → `nfe_companies`

### `notifications`
- Módulo: `Monetarie.Schemas.Notifications.Notification` (`core/backend/lib/monetarie/schemas/notifications/notification.ex:18`)
- Propósito: Notificações do sistema para usuários, com tipo, prioridade, entidade relacionada e indicação de leitura.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `type` :string; `title` :string; `entity` :string; `priority` :string (default: "medium"); `read` :boolean (default: false); `user_id` :string; `metadata` :map (default: %{})
- Índices/chaves: index [type]; index [entity_id]; index [inserted_at]; index [read]; index [user_id]; FK `entity_id` → `entities`

### `open_finance_clients` (sem schema Ecto)
- Origem: baseline `priv/repo/sql/mon_core_schema_clean.sql` (migration `20260101000000`)
- Propósito: Clientes registrados via DCR (Dynamic Client Registration) do Open Finance (controllers/open_finance/dcr_controller.ex).
- Colunas: `id` uuid NOT NULL; `client_id` character varying(255) NOT NULL; `client_secret` character varying(255); `client_name` character varying(255); `software_id` character varying(255); `organisation_id` character varying(255); `redirect_uris` character varying(255)[] DEFAULT ARRAY[]::character varying[]; `grant_types` character varying(255)[] DEFAULT ARRAY[]::character varying[]; `scope` character varying(255); `token_endpoint_auth_method` character varying(255) DEFAULT 'tls_client_auth'::character varying; `registration_access_token` character varying(255); `status` character varying(255) DEFAULT 'active'::character varying NOT NULL; `metadata` jsonb DEFAULT '{}'::jsonb; `inserted_at` timestamp without time zone NOT NULL; `updated_at` timestamp without time zone NOT NULL
- Índices/chaves: unique [client_id]; index [organisation_id]; unique [software_id]; index [status]

### `open_finance_consents`
- Módulo: `Monetarie.Schemas.OpenFinance.Consent` (`core/backend/lib/monetarie/schemas/open_finance/consent.ex:83`)
- Propósito: Consentimentos de Open Finance (Resolução Conjunta 1), com instituição solicitante, escopos autorizados, vigência e revogação.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `customer_document` EncryptedDocument; `customer_document_hash` :binary; `customer_name` :string; `requesting_institution_cnpj` :string; `requesting_institution_name` :string; `consent_type` :string; `scopes` {:array, :string}; `status` :string (default: "pending"); `authorized_at` :utc_datetime_usec; `expires_at` :utc_datetime_usec; `revoked_at` :utc_datetime_usec; `revocation_reason` :string; `interaction_id` :string; `metadata` :map (default: %{})
- Índices/chaves: index [:customer_document_hash]; index [:customer_document]

### `open_finance_data_requests`
- Módulo: `Monetarie.Schemas.OpenFinance.DataRequest` (`core/backend/lib/monetarie/schemas/open_finance/data_request.ex:33`)
- Propósito: Solicitações de compartilhamento de dados via Open Finance entre instituições, com tipo de requisição e status de resposta.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `request_type` :string; `requesting_institution_cnpj` :string; `status` :string (default: "received"); `response_data` :map; `requested_at` :utc_datetime_usec; `responded_at` :utc_datetime_usec; `error_message` :string; `metadata` :map (default: %{}); `consent_id` belongs_to `Monetarie.Schemas.OpenFinance.Consent`
- Índices/chaves: index [consent_id]; index [requesting_institution_cnpj]; index [status]; FK `consent_id` → `open_finance_consents`

### `open_finance_payment_initiations`
- Módulo: `Monetarie.Schemas.OpenFinance.PaymentInitiation` (`core/backend/lib/monetarie/schemas/open_finance/payment_initiation.ex:50`)
- Propósito: Iniciações de pagamento recebidas via Open Finance, com instituição solicitante, documentos do pagador e recebedor e dados da conta destino.
- Chave/particionamento: PK `{:id, :binary_id, autogenerate: true}`; timestamps (type: :utc_datetime_usec)
- Colunas: `requesting_institution_cnpj` :string; `payment_type` :string; `amount` :integer; `payer_document` EncryptedDocument; `payer_document_hash` :binary; `payer_account_id` :binary_id; `payee_document` EncryptedDocument; `payee_document_hash` :binary; `payee_name` :string; `payee_ispb` :string; `payee_branch` :string; `payee_account` :string; `payee_account_type` :string; `pix_key` :string; `status` :string (default: "pending"); `rejection_reason` :string; `transaction_id` :string; `idempotency_key` :string; `metadata` :map (default: %{}); `consent_id` belongs_to `Monetarie.Schemas.OpenFinance.Consent`
- Índices/chaves: index [:payer_document_hash]; index [:payee_document_hash]; FK `consent_id` → `open_finance_consents`

