{
  "module": "treasury",
  "morphisms": [
    {
      "name": "register_cash_move",
      "inputs": [
        { "role": "caja", "entity": "Caja" }
      ],
      "reads":  ["caja.saldo", "caja.currency"],
      "writes": ["caja.saldo", "Movimiento"],
      "depends_on": [],
      "script": "morphisms/register_cash_move.rhai"
    },
    {
      "name": "transfer_between_cajas",
      "inputs": [
        { "role": "source", "entity": "Caja" },
        { "role": "dest",   "entity": "Caja" }
      ],
      "reads":  ["source.saldo", "source.currency", "dest.saldo", "dest.currency"],
      "writes": ["source.saldo", "dest.saldo", "Transferencia"],
      "invariants": {
        "conserve": [
          { "entity": "Caja", "field": "saldo", "group_by": "currency" }
        ]
      },
      "depends_on": [],
      "script": "morphisms/transfer_between_cajas.rhai"
    }
  ]
}
