{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/listings-api/json-schema/listings-api-interaction-connection-schema.json",
  "title": "InteractionConnection",
  "description": "Relay-style paginated list of interactions with aggregate stats.",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/listings-api-reviews-api-openapi.yml#/components/schemas/InteractionConnection",
  "type": "object",
  "properties": {
    "pageInfo": {
      "$ref": "#/$defs/PageInfo"
    },
    "edges": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InteractionEdge"
      }
    },
    "totalCount": {
      "type": "integer",
      "format": "int32"
    },
    "interactionStats": {
      "$ref": "#/$defs/InteractionsCombinedStats"
    }
  },
  "required": [
    "pageInfo"
  ],
  "$defs": {
    "Interaction": {
      "type": "object",
      "description": "A single review, Q&A item, or social interaction collected from a source site.",
      "properties": {
        "id": {
          "type": "string"
        },
        "interactionId": {
          "type": "string"
        },
        "source": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "authorName": {
          "type": "string"
        },
        "rating": {
          "type": "integer",
          "format": "int32"
        },
        "date": {
          "type": "string"
        },
        "permalink": {
          "type": "string"
        },
        "category": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "responded": {
          "type": "boolean"
        },
        "notes": {
          "type": "string"
        },
        "responses": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InteractionResponse"
          }
        },
        "responseCount": {
          "type": "integer",
          "format": "int32"
        },
        "canRespond": {
          "type": "boolean"
        },
        "locationId": {
          "type": "integer",
          "format": "int32"
        },
        "flaggedReason": {
          "type": "string"
        }
      }
    },
    "InteractionEdge": {
      "type": "object",
      "properties": {
        "node": {
          "$ref": "#/$defs/Interaction"
        },
        "cursor": {
          "type": "string"
        }
      },
      "required": [
        "cursor"
      ]
    },
    "InteractionResponse": {
      "type": "object",
      "description": "A response to an interaction (review reply, Q&A answer).",
      "properties": {
        "id": {
          "type": "string"
        },
        "interactionId": {
          "type": "string"
        },
        "content": {
          "type": "string"
        },
        "authorName": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "respondedWith": {
          "type": "string"
        },
        "respondedBy": {
          "type": "integer",
          "format": "int32"
        },
        "interactionStatus": {
          "$ref": "#/$defs/InteractionResponseStatus"
        },
        "editedResponse": {
          "type": "boolean"
        },
        "remarks": {
          "type": "string"
        }
      }
    },
    "InteractionResponseStatus": {
      "type": "string",
      "enum": [
        "CREATED",
        "FAILED",
        "COMPLETED",
        "CONFIRMED"
      ],
      "description": "Lifecycle state of a response item as it's posted out to the source site."
    },
    "InteractionStat": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "number",
          "format": "float"
        },
        "delta": {
          "type": "number",
          "format": "float"
        },
        "abs": {
          "type": "number",
          "format": "float"
        }
      }
    },
    "InteractionsCombinedStats": {
      "type": "object",
      "properties": {
        "sitesStats": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SiteInteractionCount"
          }
        },
        "otherStats": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InteractionStat"
          }
        }
      }
    },
    "PageInfo": {
      "type": "object",
      "description": "(also defined by interactions) (also defined by v2app) (also defined by scantool) (also defined by thirdeye)",
      "properties": {
        "hasNextPage": {
          "type": "boolean"
        },
        "hasPreviousPage": {
          "type": "boolean"
        }
      }
    },
    "SiteInteractionCount": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "interactionCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    }
  }
}