{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/swift/refs/heads/main/json-schema/swift-bic-schema.json",
  "title": "SWIFT BIC",
  "description": "Schema for a SWIFT Bank Identifier Code (BIC) record from the SwiftRef API",
  "type": "object",
  "properties": {
    "bic": {
      "type": "string",
      "pattern": "^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",
      "description": "8 or 11 character Bank Identifier Code"
    },
    "institutionName": {
      "type": "string",
      "description": "Name of the financial institution"
    },
    "countryCode": {
      "type": "string",
      "pattern": "^[A-Z]{2}$",
      "description": "ISO 3166-1 alpha-2 country code"
    },
    "city": {
      "type": "string",
      "description": "City where the institution is located"
    },
    "address": {
      "type": "string",
      "description": "Institution street address"
    },
    "status": {
      "type": "string",
      "enum": ["ACTIVE", "PASSIVE", "DELISTED"],
      "description": "BIC registration status"
    },
    "connectedToBIC": {
      "type": "boolean",
      "description": "Whether the institution is connected to the SWIFT network"
    }
  },
  "required": ["bic", "institutionName", "countryCode"]
}
