{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/cash_position/v2.json",
  "title": "cash_position contract v2",
  "type": "object",
  "required": [
    "accounts",
    "as_of",
    "currency",
    "legal_entity_id",
    "total_cash"
  ],
  "properties": {
    "as_of": {
      "type": "string",
      "description": "the instant the balances were read",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "instant",
      "format": "date-time",
      "x-demiton-type": "datetime"
    },
    "summary": {
      "type": "string",
      "description": "one-line prose digest of the snapshot",
      "x-demiton-requiredness": "optional"
    },
    "accounts": {
      "type": "array",
      "description": "per-account breakdown behind the total",
      "x-demiton-requiredness": "required",
      "items": {
        "type": "object",
        "properties": {
          "balance": {
            "type": "number",
            "description": "the account's balance at `as_of`",
            "x-demiton-requiredness": "required",
            "x-demiton-unit": "`accounts[].currency`"
          },
          "currency": {
            "type": "string",
            "description": "the account's own currency",
            "x-demiton-requiredness": "optional",
            "x-demiton-type": "money"
          },
          "account_no": {
            "type": "string",
            "description": "account identifier",
            "x-demiton-requiredness": "required"
          },
          "account_name": {
            "type": "string",
            "description": "human label for the account",
            "x-demiton-requiredness": "required"
          },
          "last_statement_date": {
            "type": "string",
            "description": "date of the bank's last statement for the account",
            "x-demiton-requiredness": "optional",
            "format": "date",
            "x-demiton-type": "date"
          }
        },
        "required": [
          "account_name",
          "account_no",
          "balance"
        ]
      }
    },
    "currency": {
      "type": "currency",
      "description": "the reporting currency of `total_cash`, an ISO 4217 alpha-3 code. Each account carries its own `currency`. A record with no currency has no usable amount.",
      "x-demiton-requiredness": "required"
    },
    "total_cash": {
      "type": "number",
      "description": "sum of the account balances in the reporting currency",
      "x-demiton-requiredness": "required"
    },
    "account_count": {
      "type": "integer",
      "description": "number of accounts the total covers",
      "x-demiton-requiredness": "optional",
      "x-demiton-unit": "count"
    },
    "legal_entity_id": {
      "type": "string",
      "description": "the legal entity whose cash this is; the fact's subject anchor, stamped also as a `LEGAL_ENTITY` context coordinate",
      "x-demiton-requiredness": "required",
      "x-demiton-reference": true
    }
  },
  "x-demiton-register-type": "cash_position",
  "x-demiton-contract-version": "2.0.1",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [
    {
      "axis": "currency",
      "requirement": "optional",
      "role": "context"
    },
    {
      "axis": "legal_entity",
      "requirement": "optional",
      "role": "context"
    }
  ],
  "x-demiton-measures": [],
  "x-demiton-provenance": {
    "standards": [
      {
        "code": "Construction Contracts Act 2002 (NZ)",
        "title": "Construction Contracts Act 2002 (NZ), 2002 No 46",
        "access": "full_text_verified",
        "clause": "ss 18C, 18D, 18FD",
        "region": "New Zealand",
        "edition": "as at 5 Oct 2023 (incl. Retention Money Amendment Act 2023)",
        "checked_on": "2026-09-14"
      }
    ]
  },
  "description": "Current cash balances across bank accounts.",
  "x-demiton-contract-url": "https://docs.demiton.io/registers/cash_position/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}