{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-paginated-response-data-source-response-schema.json",
  "title": "PaginatedResponse[DataSourceResponse]",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-data-sources-api-openapi.yml#/components/schemas/PaginatedResponse_DataSourceResponse_",
  "properties": {
    "items": {
      "items": {
        "$ref": "#/$defs/DataSourceResponse"
      },
      "type": "array",
      "title": "Items"
    },
    "has_more": {
      "type": "boolean",
      "title": "Has More"
    },
    "continuation_token": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Continuation Token"
    },
    "total": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Total"
    }
  },
  "type": "object",
  "required": [
    "items",
    "has_more"
  ],
  "$defs": {
    "DataSourceResponse": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "title": "Id"
        },
        "workspace_id": {
          "type": "string",
          "format": "uuid",
          "title": "Workspace Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Display Name"
        },
        "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"
        },
        "connection_config": {
          "additionalProperties": true,
          "type": "object",
          "title": "Connection Config"
        },
        "entity_types": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Entity Types"
        },
        "field_mappings": {
          "additionalProperties": true,
          "type": "object",
          "title": "Field Mappings"
        },
        "sync_strategy": {
          "type": "string",
          "enum": [
            "manual",
            "scheduled",
            "webhook",
            "continuous"
          ],
          "title": "Sync Strategy"
        },
        "sync_schedule": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sync Schedule"
        },
        "last_sync_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Sync At"
        },
        "last_sync_status": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "success",
                "error"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Sync Status"
        },
        "last_sync_event_count": {
          "type": "integer",
          "title": "Last Sync Event Count"
        },
        "is_active": {
          "type": "boolean",
          "title": "Is Active"
        },
        "is_stale": {
          "type": "boolean",
          "title": "Is Stale"
        },
        "health_status": {
          "type": "string",
          "enum": [
            "unknown",
            "healthy",
            "degraded"
          ],
          "title": "Health Status"
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "title": "Created At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "id",
        "workspace_id",
        "name",
        "display_name",
        "source_type",
        "connection_config",
        "entity_types",
        "field_mappings",
        "sync_strategy",
        "sync_schedule",
        "last_sync_at",
        "last_sync_status",
        "last_sync_event_count",
        "is_active",
        "is_stale",
        "health_status",
        "created_at",
        "updated_at"
      ],
      "title": "DataSourceResponse"
    }
  }
}