{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/atlar/json-schema/atlar-event-schema.json",
  "title": "Event",
  "description": "A resource event.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/atlar-counterparties-api-openapi.yml#/components/schemas/Event",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "The ID of the event."
    },
    "organizationId": {
      "$ref": "#/$defs/OrganizationID"
    },
    "entityId": {
      "description": "The ID of the API resource that this event belongs to.",
      "$ref": "#/$defs/ResourceID"
    },
    "type": {
      "$ref": "#/$defs/EventType"
    },
    "name": {
      "type": "string",
      "description": "The event name. Different resources have different sets of event names."
    },
    "timestamp": {
      "description": "When the event happened.",
      "type": "string",
      "format": "date-time"
    },
    "details": {
      "description": "Additional details describing this event.",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "message": {
      "type": "string",
      "description": "A message which could either be a message from the bank or an explanation of the event."
    },
    "originator": {
      "description": "The originator of the event which could be either a user ID, BANK or ATLAR.",
      "type": "string"
    }
  },
  "required": [
    "id",
    "organizationId",
    "entityId",
    "type",
    "name",
    "originator",
    "timestamp"
  ],
  "$defs": {
    "EventType": {
      "type": "string",
      "description": "Event type.",
      "enum": [
        "CREATED",
        "UPDATED",
        "DELETED"
      ]
    },
    "OrganizationID": {
      "type": "string",
      "description": "Unique resource identifier for an Organization."
    },
    "ResourceID": {
      "type": "string",
      "description": "Unique resource identifier.",
      "minLength": 32,
      "maxLength": 64
    }
  }
}