{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/groupe-bpce/main/json-schema/groupe-bpce-internal-account-schema.json",
  "title": "InternalAccount",
  "description": "Account contract authorized to the user of the subscription and debitable as part of a transfer",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/groupe-bpce-open-finance-transfer-openapi.yml#/components/schemas/InternalAccount",
  "type": "object",
  "allOf": [
    {
      "$ref": "#/$defs/Account"
    },
    {
      "type": "object",
      "properties": {
        "productLabel": {
          "description": "Product commercial name",
          "type": "string"
        },
        "ownerLabel": {
          "description": "Designates the owner of the account. Can be a group label if there is several owners.",
          "type": "string"
        },
        "balance": {
          "$ref": "#/$defs/Amount"
        }
      },
      "required": [
        "productLabel"
      ]
    }
  ],
  "$defs": {
    "Account": {
      "title": "Account",
      "description": "This object stands for an bank account.",
      "type": "object",
      "properties": {
        "accountId": {
          "description": "Identifier of the account",
          "type": "string",
          "readOnly": true
        },
        "label": {
          "description": "Label of the account.",
          "type": "string"
        },
        "accountNumber": {
          "description": "Number of the account.",
          "type": "string"
        },
        "iban": {
          "description": "ISO 13616 format for a bank account.",
          "type": "string"
        },
        "financialInstitution": {
          "$ref": "#/$defs/FinancialInstitution"
        },
        "currencies": {
          "description": "Currencies of the account.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Currency"
          },
          "readOnly": true
        }
      },
      "required": [
        "accountId",
        "label",
        "accountNumber"
      ]
    },
    "Amount": {
      "description": "Default objet which stands for an amount (number value + currency code).",
      "type": "object",
      "properties": {
        "value": {
          "description": "Value of the amount.",
          "type": "number",
          "format": "double"
        },
        "currencyCode": {
          "description": "Alphabetical code of the currency code (ISO 4217)",
          "type": "string"
        }
      },
      "required": [
        "value",
        "currencyCode"
      ]
    },
    "Currency": {
      "title": "Currency",
      "description": "A Currency object, with a code and an optional label.",
      "type": "object",
      "properties": {
        "code": {
          "description": "An ISO 3166 3-char code for a currency.",
          "type": "string"
        },
        "label": {
          "description": "A human readable label for the currency.",
          "type": "string"
        }
      },
      "required": [
        "code"
      ]
    },
    "FinancialInstitution": {
      "title": "Financial Institution",
      "description": "A financial Institution is a legitimate organization contributing to financial operations. It is not necessarily a Bank.",
      "type": "object",
      "properties": {
        "id": {
          "description": "Financial institution identifier.",
          "type": "string",
          "readOnly": true
        },
        "label": {
          "description": "Financial institution label",
          "type": "string",
          "readOnly": true
        },
        "identifiers": {
          "description": "Financial institution identifier value and type.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": [
                  "SWIFT",
                  "BIC",
                  "BANQUE_DE_FRANCE",
                  "ABA"
                ]
              }
            }
          }
        }
      },
      "required": [
        "id",
        "label",
        "identifiers"
      ],
      "readOnly": true
    }
  }
}