{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-balance-schema.json",
  "title": "Balance",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-accounts-api-openapi.yml#/components/schemas/Balance",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/ResourceID"
    },
    "accountId": {
      "$ref": "#/$defs/ResourceID",
      "description": "Account ID."
    },
    "organizationId": {
      "$ref": "#/$defs/OrganizationID"
    },
    "type": {
      "$ref": "#/$defs/BalanceType",
      "readOnly": true
    },
    "reportedType": {
      "$ref": "#/$defs/BalanceReportedType",
      "readOnly": true
    },
    "amount": {
      "$ref": "#/$defs/Amount",
      "readOnly": true
    },
    "localDate": {
      "description": "Local date in the timezone associated with the account/bank.",
      "$ref": "#/$defs/Date",
      "readOnly": true
    },
    "timestamp": {
      "description": "Timestamp of when the balance entry was recorded on the account. This timestamp is reported in UTC and thus the date component of this timestamp may be different than `localDate`.",
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "created": {
      "description": "Timestamp of when the balance entry was created in Atlar. This is distinct from `timestamp`, which reflects when the balance was recorded on the account by the bank. For example, an end-of-day balance may have a `timestamp` of 23:59 but be `created` the following day when the bank statement was delivered to Atlar.",
      "$ref": "#/$defs/CreatedTimestamp",
      "readOnly": true
    },
    "version": {
      "$ref": "#/$defs/ResourceVersion",
      "readOnly": true
    }
  },
  "required": [
    "id",
    "accountId",
    "organizationId",
    "type",
    "reportedType",
    "amount",
    "localDate",
    "timestamp",
    "created",
    "version"
  ],
  "$defs": {
    "Amount": {
      "type": "object",
      "properties": {
        "currency": {
          "$ref": "#/$defs/CurrencyCode"
        },
        "stringValue": {
          "description": "A string representation of the amount value. This will be\na decimal number if the currency has decimals. The number\nis not formatted for display purposes (e.g. with locale\nspecific thousand separator) and always contains the dot\n`.` character as decimal separator.",
          "type": "string"
        },
        "value": {
          "description": "The amount value as an integer (int64) represented in\ncurrency minor units (e.g. 15.02 EUR is represented as the\nvalue 1502).",
          "type": "integer",
          "format": "int64"
        }
      },
      "required": [
        "currency",
        "stringValue",
        "value"
      ]
    },
    "BalanceReportedType": {
      "type": "string",
      "enum": [
        "OPEN",
        "CLOSE",
        "INTERIM"
      ]
    },
    "BalanceType": {
      "type": "string",
      "enum": [
        "BOOKED",
        "BOOKED_ADJUSTED",
        "AVAILABLE"
      ]
    },
    "CreatedTimestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Time at which the resource was created.",
      "readOnly": true
    },
    "CurrencyCode": {
      "type": "string",
      "description": "Three-letter ISO 4217 currency code.",
      "minLength": 3,
      "maxLength": 3,
      "pattern": "^[A-Z]{3,3}$"
    },
    "Date": {
      "type": "string",
      "format": "date",
      "description": "`full-date` notation as defined by [RFC 3339, section 5.6](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), for example, `2017-07-21`."
    },
    "OrganizationID": {
      "type": "string",
      "description": "Unique resource identifier for an Organization."
    },
    "ResourceID": {
      "type": "string",
      "description": "Unique resource identifier.",
      "minLength": 32,
      "maxLength": 64
    },
    "ResourceVersion": {
      "type": "integer",
      "description": "Resource version. Starts at value `1` when the resource is\ncreated and increases by one for each successive update.",
      "minimum": 1,
      "readOnly": true
    }
  }
}