{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rivaire-pro/json-schema/rivaire-pro-wallet-schema.json",
  "title": "Wallet",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rivaire-pro-openapi.json#/components/schemas/Wallet",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "workspaceId": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "currencyId": {
      "type": "string"
    },
    "balance": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Decimal string like `\"12.50\"`. `null` if the token keeps amounts locked; see `encrypted`."
    },
    "version": {
      "type": "integer",
      "description": "Balance version. Send it as `expectedVersion` in `walletBalanceUpdates`."
    },
    "icon": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "regular",
        "debt"
      ]
    },
    "isHidden": {
      "type": "boolean"
    },
    "acceptsTransactions": {
      "type": "boolean"
    },
    "includeInBalances": {
      "type": "boolean"
    },
    "includeInMainTotal": {
      "type": "boolean",
      "description": "Whether you count it in your Main total; your own choice."
    },
    "sort": {
      "type": "integer"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "encrypted": {
      "description": "The stored balance, for tokens that keep amounts locked.",
      "type": "object",
      "properties": {
        "balance": {
          "$ref": "#/$defs/EncryptedMoney"
        }
      },
      "required": [
        "balance"
      ]
    }
  },
  "required": [
    "id",
    "workspaceId",
    "name",
    "currencyId",
    "balance",
    "version",
    "icon",
    "kind",
    "isHidden",
    "acceptsTransactions",
    "includeInBalances",
    "includeInMainTotal",
    "sort",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "EncryptedMoney": {
      "type": "object",
      "properties": {
        "ciphertext": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        },
        "iv": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "algorithm": {
          "type": "string",
          "const": "AES-GCM"
        },
        "keyVersion": {
          "type": "integer",
          "exclusiveMinimum": 0
        },
        "keyId": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "ciphertext",
        "iv",
        "algorithm",
        "keyVersion"
      ],
      "description": "An encrypted value (AES-256-GCM; `ciphertext` and `iv` in base64). Without `keyId` it is under your money key (Main workspace); with it, under that workspace key."
    }
  }
}