{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/guestgraph-io/json-schema/guestgraph-io-status-schema.json",
  "title": "Status",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/guestgraph-io-apaleo-openapi.yml#/components/schemas/Status",
  "type": "object",
  "required": [
    "connections"
  ],
  "properties": {
    "connections": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ConnectionStatus"
      }
    }
  },
  "$defs": {
    "ConnectionStatus": {
      "type": "object",
      "required": [
        "id",
        "tenantLabel",
        "account",
        "properties",
        "subscription",
        "syncPoints",
        "counters",
        "pendingEvents",
        "splitsAwaitingPerson",
        "lastActivityAt",
        "lastError"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "tenantLabel": {
          "type": "string"
        },
        "account": {
          "type": "string"
        },
        "properties": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "subscription": {
          "type": "object",
          "required": [
            "active",
            "eventTypes"
          ],
          "properties": {
            "active": {
              "type": "boolean"
            },
            "id": {
              "type": [
                "string",
                "null"
              ]
            },
            "eventTypes": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "syncPoints": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "propertyId",
              "modifiedThrough"
            ],
            "properties": {
              "propertyId": {
                "type": "string"
              },
              "modifiedThrough": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "lastFullSyncAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "lastReconcileAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          }
        },
        "lastActivityAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "The last successful run or event; a gap longer than Apaleo's retry window starts a full sync."
        },
        "counters": {
          "description": "Since the connection's state was created.",
          "type": "object",
          "required": [
            "versionsSubmitted",
            "recordsSubmitted",
            "duplicates",
            "flaggedForReview",
            "errors"
          ],
          "properties": {
            "versionsSubmitted": {
              "type": "integer"
            },
            "recordsSubmitted": {
              "type": "integer"
            },
            "duplicates": {
              "type": "integer"
            },
            "flaggedForReview": {
              "type": "integer"
            },
            "errors": {
              "type": "integer"
            }
          }
        },
        "pendingEvents": {
          "type": "integer",
          "description": "Deliveries stored and not yet successfully processed."
        },
        "splitsAwaitingPerson": {
          "type": "integer",
          "description": "Held guest ids whose refresh answered SPLIT or RETIRED."
        },
        "lastRefreshAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "lastError": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "at": {
              "type": "string",
              "format": "date-time"
            },
            "where": {
              "type": "string",
              "enum": [
                "APALEO",
                "ENGINE",
                "DATABASE"
              ]
            },
            "reason": {
              "type": "string",
              "description": "Never a payload",
              "never a credential.": null
            }
          }
        }
      }
    }
  }
}