{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "$ref": "#/$defs/d0_publicUnavailable"
    },
    {
      "$ref": "#/$defs/d3_publicActivityAvailable"
    }
  ],
  "$defs": {
    "d1_release": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]{2,127}$"
        },
        "protocolRevision": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]{2,63}$"
        },
        "rewardModelRevision": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]{2,63}$"
        }
      },
      "required": [
        "id",
        "protocolRevision",
        "rewardModelRevision"
      ],
      "additionalProperties": false
    },
    "d2_unavailableReason": {
      "enum": [
        "indexer_disabled",
        "not_yet_safe",
        "indexer_unavailable",
        "indexer_mismatch",
        "unsupported_contract_version",
        "projection_rebuilding"
      ]
    },
    "d0_publicUnavailable": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "const": 2
        },
        "release": {
          "anyOf": [
            {
              "$ref": "#/$defs/d1_release"
            },
            {
              "type": "null"
            }
          ]
        },
        "installationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "const": "unavailable"
        },
        "reason": {
          "$ref": "#/$defs/d2_unavailableReason"
        }
      },
      "required": [
        "schemaVersion",
        "release",
        "installationId",
        "status",
        "reason"
      ],
      "additionalProperties": false
    },
    "d4_timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "d5_address": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{40}$"
    },
    "d7_decimal": {
      "type": "string",
      "format": "uint256-decimal"
    },
    "d8_bytes32": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{64}$"
    },
    "d6_chain": {
      "type": "object",
      "properties": {
        "target": {
          "enum": [
            "anvil",
            "sepolia",
            "mainnet"
          ]
        },
        "chainId": {
          "$ref": "#/$defs/d7_decimal"
        },
        "confirmations": {
          "const": "12"
        },
        "deploymentBlock": {
          "$ref": "#/$defs/d7_decimal"
        },
        "economyDeploymentBlock": {
          "$ref": "#/$defs/d7_decimal"
        },
        "indexedThroughBlock": {
          "$ref": "#/$defs/d7_decimal"
        },
        "safeThroughBlock": {
          "$ref": "#/$defs/d7_decimal"
        },
        "safeBlockHash": {
          "$ref": "#/$defs/d8_bytes32"
        },
        "safeBlockTimestamp": {
          "$ref": "#/$defs/d4_timestamp"
        }
      },
      "required": [
        "target",
        "chainId",
        "confirmations",
        "deploymentBlock",
        "economyDeploymentBlock",
        "indexedThroughBlock",
        "safeThroughBlock",
        "safeBlockHash",
        "safeBlockTimestamp"
      ],
      "additionalProperties": false
    },
    "d9_identities": {
      "type": "object",
      "properties": {
        "core": {
          "$ref": "#/$defs/d5_address"
        },
        "tokenFactory": {
          "$ref": "#/$defs/d5_address"
        },
        "mining": {
          "$ref": "#/$defs/d5_address"
        },
        "token": {
          "$ref": "#/$defs/d5_address"
        },
        "collection": {
          "$ref": "#/$defs/d5_address"
        },
        "miningImplementation": {
          "$ref": "#/$defs/d5_address"
        },
        "miningImplementationVersion": {
          "$ref": "#/$defs/d7_decimal"
        },
        "miningStorageLayoutDigest": {
          "$ref": "#/$defs/d8_bytes32"
        }
      },
      "required": [
        "core",
        "tokenFactory",
        "mining",
        "token",
        "collection",
        "miningImplementation",
        "miningImplementationVersion",
        "miningStorageLayoutDigest"
      ],
      "additionalProperties": false
    },
    "d11_activitySource": {
      "type": "object",
      "properties": {
        "blockNumber": {
          "$ref": "#/$defs/d7_decimal"
        },
        "blockHash": {
          "$ref": "#/$defs/d8_bytes32"
        },
        "blockTimestamp": {
          "$ref": "#/$defs/d4_timestamp"
        },
        "transactionHash": {
          "$ref": "#/$defs/d8_bytes32"
        },
        "transactionIndex": {
          "$ref": "#/$defs/d7_decimal"
        },
        "logIndex": {
          "$ref": "#/$defs/d7_decimal"
        },
        "confirmationStatus": {
          "const": "safe"
        }
      },
      "required": [
        "blockNumber",
        "blockHash",
        "blockTimestamp",
        "transactionHash",
        "transactionIndex",
        "logIndex",
        "confirmationStatus"
      ],
      "additionalProperties": false
    },
    "d10_activity": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "kind": {
          "enum": [
            "mint",
            "merge",
            "claim",
            "transfer",
            "checkpoint"
          ]
        },
        "tokenIds": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/d7_decimal"
          }
        },
        "amountBaseUnits": {
          "anyOf": [
            {
              "$ref": "#/$defs/d7_decimal"
            },
            {
              "type": "null"
            }
          ]
        },
        "from": {
          "anyOf": [
            {
              "$ref": "#/$defs/d5_address"
            },
            {
              "type": "null"
            }
          ]
        },
        "to": {
          "anyOf": [
            {
              "$ref": "#/$defs/d5_address"
            },
            {
              "type": "null"
            }
          ]
        },
        "level": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1,
              "maximum": 14
            },
            {
              "type": "null"
            }
          ]
        },
        "effectiveRound": {
          "anyOf": [
            {
              "$ref": "#/$defs/d7_decimal"
            },
            {
              "type": "null"
            }
          ]
        },
        "nextMergeBlock": {
          "anyOf": [
            {
              "$ref": "#/$defs/d7_decimal"
            },
            {
              "type": "null"
            }
          ]
        },
        "source": {
          "$ref": "#/$defs/d11_activitySource"
        }
      },
      "required": [
        "id",
        "kind",
        "tokenIds",
        "amountBaseUnits",
        "from",
        "to",
        "level",
        "effectiveRound",
        "nextMergeBlock",
        "source"
      ],
      "additionalProperties": false
    },
    "d12_cursor": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^[A-Za-z0-9_-]+$"
    },
    "d3_publicActivityAvailable": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "const": 2
        },
        "release": {
          "$ref": "#/$defs/d1_release"
        },
        "installationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "const": "available"
        },
        "generatedAt": {
          "$ref": "#/$defs/d4_timestamp"
        },
        "owner": {
          "$ref": "#/$defs/d5_address"
        },
        "chain": {
          "$ref": "#/$defs/d6_chain"
        },
        "identities": {
          "$ref": "#/$defs/d9_identities"
        },
        "activity": {
          "type": "array",
          "maxItems": 100,
          "items": {
            "$ref": "#/$defs/d10_activity"
          }
        },
        "total": {
          "$ref": "#/$defs/d7_decimal"
        },
        "nextCursor": {
          "anyOf": [
            {
              "$ref": "#/$defs/d12_cursor"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "schemaVersion",
        "release",
        "installationId",
        "status",
        "generatedAt",
        "owner",
        "chain",
        "identities",
        "activity",
        "nextCursor"
      ],
      "additionalProperties": false
    }
  },
  "$comment": "Public response structure from source snapshot 9e38b9313c9b4926ad15c7cd691d7f5789bdbc55. See endpoint notes for semantic constraints."
}
