{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/memo-bank/main/json-schema/memo-bank-account-page-schema.json",
  "title": "AccountPage",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/memo-bank-accounts-api-openapi.yml#/components/schemas/AccountPage",
  "required": [
    "has_next",
    "has_prev",
    "results"
  ],
  "type": "object",
  "properties": {
    "results": {
      "type": "array",
      "description": "Elements of the page.",
      "items": {
        "$ref": "#/$defs/Account"
      }
    },
    "has_prev": {
      "type": "boolean",
      "description": "Flag indicating if there is a previous page. Deprecated, use `prev_page_token` instead.",
      "deprecated": true
    },
    "has_next": {
      "type": "boolean",
      "description": "Flag indicating if there is a next page. Deprecated, use `next_page_token` instead.",
      "deprecated": true
    },
    "next_page_token": {
      "type": [
        "string",
        "null"
      ],
      "description": "Token to fetch the next page, to be passed in subsequent requests as the `page_token` query parameter. `null` when there is no next page."
    },
    "prev_page_token": {
      "type": [
        "string",
        "null"
      ],
      "description": "Token to fetch the previous page, to be passed in subsequent requests as the `page_token` query parameter. `null` when there is no previous page."
    }
  },
  "$defs": {
    "Account": {
      "required": [
        "balance",
        "currency",
        "iban",
        "id",
        "is_main",
        "name",
        "status",
        "type"
      ],
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "ID of the account.",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "description": "Name of the account, as seen in the Memo Bank interface."
        },
        "status": {
          "type": "string",
          "description": "Status of the account.",
          "enum": [
            "active",
            "closed"
          ]
        },
        "balance": {
          "type": "integer",
          "description": "Balance of the account, in the smallest unit of the `currency`. It represents the **available** money on the account at the time of the request. Note that authorized overdrafts are not included in the balance.",
          "format": "int64"
        },
        "currency": {
          "type": "string",
          "description": "Currency of the account balance, in ISO 4217 format."
        },
        "iban": {
          "type": "string",
          "description": "Main IBAN of the account."
        },
        "type": {
          "type": "string",
          "description": "Type of the account.",
          "enum": [
            "current_account",
            "ring_fenced_account",
            "ring_fenced_credit_servicer_account",
            "settlement_account",
            "specially_dedicated_account",
            "trust_account",
            "meal_voucher_account",
            "booster_account",
            "dedicated_liquidity_account",
            "dedicated_recovery_account",
            "line_item_sub_account"
          ]
        },
        "is_main": {
          "type": "boolean",
          "description": "Flag indicating if this account is the main account of your workspace. "
        }
      }
    }
  }
}