{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/immowelt/json-schema/immowelt-webhook-audit-response-schema.json",
  "title": "webhookAuditResponse",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/immowelt-seeker-leads-openapi.yml#/components/schemas/webhookAuditResponse",
  "type": "object",
  "properties": {
    "subscriptionId": {
      "type": "string"
    },
    "url": {
      "type": "string",
      "format": "url",
      "description": "The client endpoint used to receive new lead notifications."
    },
    "status": {
      "$ref": "#/$defs/subscriptionStatus"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "lastSuccessTimestamp": {
      "description": "Timestamp of the last successful webhook notification, empty if never succeeded.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "recentEvents": {
      "description": "List of recent webhook notification events, ordered from most recent to oldest.\n",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "eventId": {
            "description": "Unique identifier for the webhook event.",
            "type": "string"
          },
          "leadId": {
            "description": "lead identifier",
            "type": "string"
          },
          "status": {
            "description": "Status of the webhook notification attempt.",
            "type": "string",
            "enum": [
              "PENDING",
              "SUCCEEDED",
              "FAILED"
            ]
          },
          "attemptCount": {
            "description": "Number of attempts made to deliver the webhook notification.",
            "type": "integer"
          },
          "responseCode": {
            "description": "HTTP response code returned by the client webhook endpoint.",
            "type": [
              "integer",
              "null"
            ]
          },
          "errorMessage": {
            "description": "A custom error message in case of no response returned.",
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "description": "Timestamp when the webhook event was created.",
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "description": "Timestamp when the webhook event was last updated.",
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "eventId",
          "leadId",
          "status",
          "attemptCount",
          "createdAt",
          "updatedAt"
        ]
      }
    }
  },
  "required": [
    "subscriptionId",
    "url",
    "status",
    "createdAt",
    "updatedAt",
    "recentEvents"
  ],
  "$defs": {
    "subscriptionStatus": {
      "type": "string",
      "description": "The status of the subscription.",
      "enum": [
        "ACTIVE",
        "INACTIVE"
      ]
    }
  }
}