{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/comingup-today/json-schema/comingup-today-ok-envelope-event-retention-health-schema.json",
  "title": "OkEnvelopeEventRetentionHealth",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/comingup-today-internal-api-openapi.yml#/components/schemas/OkEnvelopeEventRetentionHealth",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "available": {
          "type": "boolean"
        },
        "productionApplySupported": {
          "type": "boolean",
          "enum": [
            false
          ]
        },
        "lastSuccessfulBatchAt": {
          "type": [
            "string",
            "null"
          ]
        },
        "backlogEstimate": {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "bounded_sample_lower_bound"
              ]
            },
            "sampledSources": {
              "type": "integer"
            },
            "sampleLimit": {
              "type": "integer"
            },
            "hasMore": {
              "type": "boolean"
            },
            "eligibleSources": {
              "type": "integer"
            },
            "expiredOneTimeSources": {
              "type": "integer"
            },
            "oldestEligibleEnd": {
              "type": [
                "string",
                "null"
              ]
            },
            "oldestEligibleAgeDays": {
              "type": [
                "integer",
                "null"
              ]
            },
            "oldestExpiredEnd": {
              "type": [
                "string",
                "null"
              ]
            },
            "oldestExpiredAgeDays": {
              "type": [
                "integer",
                "null"
              ]
            }
          },
          "required": [
            "kind",
            "sampledSources",
            "sampleLimit",
            "hasMore",
            "eligibleSources",
            "expiredOneTimeSources",
            "oldestEligibleEnd",
            "oldestEligibleAgeDays",
            "oldestExpiredEnd",
            "oldestExpiredAgeDays"
          ],
          "additionalProperties": false
        },
        "progress": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "orgId": {
                "type": "string"
              },
              "cursorSourceId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastCompletedAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lastBatchAt": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "summary": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "policyVersion": {
                    "type": "string",
                    "enum": [
                      "event-history-proposed-v1"
                    ]
                  },
                  "mode": {
                    "type": "string",
                    "enum": [
                      "preview",
                      "local_apply"
                    ]
                  },
                  "examined": {
                    "type": "integer"
                  },
                  "eligible": {
                    "type": "integer"
                  },
                  "deleted": {
                    "type": "integer"
                  },
                  "deletedInstances": {
                    "type": "integer"
                  },
                  "deletedExceptions": {
                    "type": "integer"
                  },
                  "deletedAttempts": {
                    "type": "integer"
                  },
                  "deletedDeliveries": {
                    "type": "integer"
                  },
                  "deletedContacts": {
                    "type": "integer"
                  },
                  "deletedKioskAlerts": {
                    "type": "integer"
                  },
                  "skipped": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "integer"
                    }
                  },
                  "failed": {
                    "type": "integer"
                  },
                  "reconciledFailures": {
                    "type": "integer"
                  },
                  "oldestEligibleEnd": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "policyVersion",
                  "mode",
                  "examined",
                  "eligible",
                  "deleted",
                  "deletedInstances",
                  "deletedExceptions",
                  "deletedAttempts",
                  "deletedDeliveries",
                  "deletedContacts",
                  "deletedKioskAlerts",
                  "skipped",
                  "failed",
                  "reconciledFailures",
                  "oldestEligibleEnd"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "orgId",
              "cursorSourceId",
              "lastCompletedAt",
              "lastBatchAt",
              "summary"
            ],
            "additionalProperties": false
          }
        },
        "failures": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "orgId": {
                "type": "string"
              },
              "sourceId": {
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "classification": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "nextAttemptAt": {
                "type": "string"
              },
              "updatedAt": {
                "type": "string"
              }
            },
            "required": [
              "orgId",
              "sourceId",
              "attempts",
              "classification",
              "code",
              "nextAttemptAt",
              "updatedAt"
            ],
            "additionalProperties": false
          }
        },
        "truncatedAt": {
          "type": "integer"
        }
      },
      "required": [
        "available",
        "productionApplySupported",
        "lastSuccessfulBatchAt",
        "backlogEstimate",
        "progress",
        "failures",
        "truncatedAt"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ],
  "additionalProperties": false
}