{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-pipeline-status-response-schema.json",
  "title": "PipelineStatusResponse",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-pipeline-api-openapi.yml#/components/schemas/PipelineStatusResponse",
  "properties": {
    "status": {
      "type": "string",
      "title": "Status"
    },
    "connector_runner_status": {
      "type": "string",
      "title": "Connector Runner Status"
    },
    "uptime_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Uptime Seconds"
    },
    "active_polls": {
      "type": "integer",
      "title": "Active Polls",
      "default": 0
    },
    "total_events": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Total Events",
      "description": "Read-model event count for the last 7 days. Null means the read model is empty or unavailable; zero means the read model is ready and has no events."
    },
    "event_read_model_status": {
      "type": "string",
      "enum": [
        "ready",
        "empty",
        "unavailable"
      ],
      "title": "Event Read Model Status",
      "default": "empty"
    },
    "event_read_model_synced_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Event Read Model Synced At"
    },
    "total_entities": {
      "type": "integer",
      "title": "Total Entities",
      "default": 0
    },
    "sources": {
      "items": {
        "$ref": "#/$defs/SourceStatus"
      },
      "type": "array",
      "title": "Sources",
      "default": []
    },
    "entity_resolution": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Entity Resolution"
    },
    "review_loop": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Review Loop"
    },
    "outbound_dispatch": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Outbound Dispatch"
    },
    "outbound_subscriber": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Outbound Subscriber"
    },
    "reconciliation": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reconciliation"
    },
    "gap_scanner": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Gap Scanner"
    }
  },
  "type": "object",
  "required": [
    "status",
    "connector_runner_status"
  ],
  "$defs": {
    "SourceStatus": {
      "properties": {
        "data_source_id": {
          "type": "string",
          "format": "uuid",
          "title": "Data Source Id"
        },
        "workspace_id": {
          "type": "string",
          "format": "uuid",
          "title": "Workspace Id"
        },
        "source_type": {
          "type": "string",
          "enum": [
            "rest_api",
            "webhook",
            "file_drop",
            "fhir_store",
            "ehr",
            "database",
            "custom",
            "smart_fhir",
            "customer_intake",
            "lakebase_schema",
            "crm"
          ],
          "title": "Source Type"
        },
        "connector_type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Connector Type"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "last_poll_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Poll At"
        },
        "last_poll_duration_ms": {
          "type": "integer",
          "title": "Last Poll Duration Ms",
          "default": 0
        },
        "last_poll_event_count": {
          "type": "integer",
          "title": "Last Poll Event Count",
          "default": 0
        },
        "last_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Error"
        },
        "consecutive_errors": {
          "type": "integer",
          "title": "Consecutive Errors",
          "default": 0
        },
        "connection_healthy": {
          "type": "boolean",
          "title": "Connection Healthy",
          "default": true
        }
      },
      "type": "object",
      "required": [
        "data_source_id",
        "workspace_id",
        "source_type",
        "status"
      ],
      "title": "SourceStatus"
    }
  }
}