{
  "$defs": {
    "AccountBalance": {
      "description": "One-line balance for a single bank account in the position snapshot.",
      "properties": {
        "account_ref": {
          "$ref": "#/$defs/PathRef",
          "description": "PathRef into a BankAccount record."
        },
        "classification": {
          "$ref": "#/$defs/CashClassification"
        },
        "fx_rate": {
          "format": "double",
          "type": "number"
        },
        "fx_rate_source": {
          "anyOf": [
            {
              "$ref": "#/$defs/PathRef"
            },
            {
              "type": "null"
            }
          ],
          "description": "PathRef into the FxRateTable entry that sourced the rate."
        },
        "ledger_balance": {
          "format": "double",
          "type": "number"
        },
        "ledger_currency": {
          "$ref": "#/$defs/IsoCurrency"
        },
        "reporting_balance": {
          "format": "double",
          "type": "number"
        },
        "reporting_currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "account_ref",
        "ledger_currency",
        "ledger_balance",
        "reporting_currency",
        "fx_rate",
        "reporting_balance",
        "classification"
      ],
      "type": "object"
    },
    "CashClassification": {
      "description": "Classification of cash held in an account.",
      "enum": [
        "operating",
        "restricted",
        "escrow",
        "tax_reserve",
        "investment",
        "collateral"
      ],
      "type": "string"
    },
    "CurrencyTotal": {
      "description": "Per-currency total for the snapshot.",
      "properties": {
        "amount": {
          "format": "double",
          "type": "number"
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "currency",
        "amount"
      ],
      "type": "object"
    },
    "IsoCurrency": {
      "description": "ISO 4217 currency code.",
      "pattern": "^[A-Z]{3}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "LiquidityRatios": {
      "description": "Liquidity ratios snapshot.",
      "properties": {
        "cash_ratio": {
          "format": "double",
          "type": "number"
        },
        "current_ratio": {
          "format": "double",
          "type": "number"
        },
        "quick_ratio": {
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "quick_ratio",
        "current_ratio",
        "cash_ratio"
      ],
      "type": "object"
    },
    "MonetaryAmount": {
      "description": "A monetary value with currency.",
      "properties": {
        "amount": {
          "format": "double",
          "type": "number"
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency"
        }
      },
      "required": [
        "amount",
        "currency"
      ],
      "type": "object"
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.16.0/cash-position.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Cash position snapshot.",
  "properties": {
    "as_of": {
      "$ref": "#/$defs/IsoDate"
    },
    "as_of_instant": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Refined intraday instant when applicable (for intraday treasury\nreporting)."
    },
    "balances": {
      "items": {
        "$ref": "#/$defs/AccountBalance"
      },
      "type": "array"
    },
    "content_hash": {
      "type": "string"
    },
    "entity": {
      "$ref": "#/$defs/PathRef"
    },
    "generated_at": {
      "$ref": "#/$defs/IsoDate"
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "journal_entries": {
      "description": "PathRefs into BDR 0066 journal entries since the previous\nsnapshot.",
      "items": {
        "$ref": "#/$defs/PathRef"
      },
      "type": "array"
    },
    "liquidity_ratios": {
      "anyOf": [
        {
          "$ref": "#/$defs/LiquidityRatios"
        },
        {
          "type": "null"
        }
      ]
    },
    "minimum_cash_policy_floor": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "reporting_currency": {
      "$ref": "#/$defs/IsoCurrency"
    },
    "restricted_cash_total": {
      "anyOf": [
        {
          "$ref": "#/$defs/MonetaryAmount"
        },
        {
          "type": "null"
        }
      ]
    },
    "runway_months_at_position": {
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "total_by_currency": {
      "items": {
        "$ref": "#/$defs/CurrencyTotal"
      },
      "type": "array"
    },
    "total_reporting_currency": {
      "$ref": "#/$defs/MonetaryAmount"
    }
  },
  "required": [
    "id",
    "entity",
    "as_of",
    "reporting_currency",
    "balances",
    "total_by_currency",
    "total_reporting_currency",
    "content_hash",
    "generated_at"
  ],
  "title": "CashPosition",
  "type": "object",
  "x-corpospec-pillar": "financials"
}