{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "$ref": "#/$defs/d0_unavailable"
    },
    {
      "$ref": "#/$defs/d1_available"
    }
  ],
  "$defs": {
    "d0_unavailable": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "installationId",
        "status",
        "reason"
      ],
      "properties": {
        "schemaVersion": {
          "const": 4
        },
        "installationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "const": "unavailable"
        },
        "reason": {
          "enum": [
            "indexer_disabled",
            "not_yet_safe",
            "indexer_unavailable",
            "indexer_mismatch"
          ]
        }
      }
    },
    "d3_decimal": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)$",
      "format": "uint256-decimal"
    },
    "d2_chain": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "target",
        "chainId",
        "confirmations",
        "deploymentBlock",
        "indexedThroughBlock",
        "safeThroughBlock"
      ],
      "properties": {
        "target": {
          "enum": [
            "anvil",
            "sepolia",
            "mainnet"
          ]
        },
        "chainId": {
          "$ref": "#/$defs/d3_decimal"
        },
        "confirmations": {
          "const": "12"
        },
        "deploymentBlock": {
          "$ref": "#/$defs/d3_decimal"
        },
        "indexedThroughBlock": {
          "$ref": "#/$defs/d3_decimal"
        },
        "safeThroughBlock": {
          "$ref": "#/$defs/d3_decimal"
        }
      }
    },
    "d5_address": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{40}$"
    },
    "d4_identities": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "factory",
        "core",
        "proxyAdmin",
        "proxyAdminOwner",
        "operatorTimelock",
        "operatorProposer",
        "proxyImplementation",
        "proxyAdminSlot"
      ],
      "properties": {
        "factory": {
          "$ref": "#/$defs/d5_address"
        },
        "core": {
          "$ref": "#/$defs/d5_address"
        },
        "proxyAdmin": {
          "$ref": "#/$defs/d5_address"
        },
        "proxyAdminOwner": {
          "$ref": "#/$defs/d5_address"
        },
        "operatorTimelock": {
          "$ref": "#/$defs/d5_address"
        },
        "operatorProposer": {
          "$ref": "#/$defs/d5_address"
        },
        "proxyImplementation": {
          "$ref": "#/$defs/d5_address"
        },
        "proxyAdminSlot": {
          "$ref": "#/$defs/d5_address"
        }
      }
    },
    "d7_bytes32": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{64}$"
    },
    "d8_workPerBlock": {
      "type": "string",
      "pattern": "^[1-9][0-9]*$",
      "format": "uint64-decimal"
    },
    "d6_configuration": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "streamId",
        "genesisTimestamp",
        "roundDuration",
        "maxWorkPerRound",
        "maxRoundsPerBatch",
        "guardian",
        "reporter",
        "workPerBlock"
      ],
      "properties": {
        "streamId": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "genesisTimestamp": {
          "$ref": "#/$defs/d3_decimal"
        },
        "roundDuration": {
          "$ref": "#/$defs/d3_decimal"
        },
        "maxWorkPerRound": {
          "$ref": "#/$defs/d3_decimal"
        },
        "maxRoundsPerBatch": {
          "$ref": "#/$defs/d3_decimal"
        },
        "guardian": {
          "$ref": "#/$defs/d5_address"
        },
        "reporter": {
          "$ref": "#/$defs/d5_address"
        },
        "workPerBlock": {
          "$ref": "#/$defs/d8_workPerBlock"
        }
      }
    },
    "d9_core": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "settledThroughRound",
        "cumulativeWork",
        "blockHeight",
        "currentWork",
        "workPerBlock",
        "authorizationNonce",
        "paused"
      ],
      "properties": {
        "settledThroughRound": {
          "$ref": "#/$defs/d3_decimal"
        },
        "cumulativeWork": {
          "$ref": "#/$defs/d3_decimal"
        },
        "blockHeight": {
          "$ref": "#/$defs/d3_decimal"
        },
        "currentWork": {
          "$ref": "#/$defs/d3_decimal"
        },
        "workPerBlock": {
          "$ref": "#/$defs/d8_workPerBlock"
        },
        "authorizationNonce": {
          "$ref": "#/$defs/d3_decimal"
        },
        "paused": {
          "type": "boolean"
        }
      }
    },
    "d10_implementation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "codeAddress",
        "codeVersion",
        "storageLayoutDigest",
        "runtimeHash"
      ],
      "properties": {
        "codeAddress": {
          "$ref": "#/$defs/d5_address"
        },
        "codeVersion": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "storageLayoutDigest": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "runtimeHash": {
          "$ref": "#/$defs/d7_bytes32"
        }
      }
    },
    "d11_governance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "operationId",
        "operationKind",
        "operationState"
      ],
      "properties": {
        "operationId": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "operationKind": {
          "enum": [
            "None",
            "Upgrade",
            "Conflict"
          ]
        },
        "operationState": {
          "enum": [
            "None",
            "Pending",
            "Executed",
            "Cancelled",
            "Conflict"
          ]
        }
      }
    },
    "d13_eventName": {
      "enum": [
        "SqueekDeploymentCreated",
        "CoreInitialized",
        "ReporterUpdated",
        "RoundRecorded",
        "BatchSettled",
        "Initialized",
        "Upgraded",
        "AdminChanged",
        "Paused",
        "Unpaused",
        "OwnershipTransferred",
        "CallScheduled",
        "CallExecuted",
        "Cancelled"
      ]
    },
    "d12_source": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "eventName",
        "blockNumber",
        "blockHash",
        "blockTimestamp",
        "transactionHash",
        "transactionIndex",
        "logIndex"
      ],
      "properties": {
        "eventName": {
          "$ref": "#/$defs/d13_eventName"
        },
        "blockNumber": {
          "$ref": "#/$defs/d3_decimal"
        },
        "blockHash": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "blockTimestamp": {
          "$ref": "#/$defs/d3_decimal"
        },
        "transactionHash": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "transactionIndex": {
          "$ref": "#/$defs/d3_decimal"
        },
        "logIndex": {
          "$ref": "#/$defs/d3_decimal"
        }
      }
    },
    "d15_eventArgument": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "value"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "boolean"
            }
          ]
        }
      }
    },
    "d14_event": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "contractKind",
        "contractAddress",
        "eventName",
        "blockNumber",
        "blockHash",
        "blockTimestamp",
        "transactionHash",
        "transactionIndex",
        "logIndex",
        "arguments"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "contractKind": {
          "enum": [
            "factory",
            "core",
            "proxy",
            "proxyAdmin",
            "timelock"
          ]
        },
        "contractAddress": {
          "$ref": "#/$defs/d5_address"
        },
        "eventName": {
          "$ref": "#/$defs/d13_eventName"
        },
        "blockNumber": {
          "$ref": "#/$defs/d3_decimal"
        },
        "blockHash": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "blockTimestamp": {
          "$ref": "#/$defs/d3_decimal"
        },
        "transactionHash": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "transactionIndex": {
          "$ref": "#/$defs/d3_decimal"
        },
        "logIndex": {
          "$ref": "#/$defs/d3_decimal"
        },
        "arguments": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/d15_eventArgument"
          }
        }
      }
    },
    "d1_available": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "installationId",
        "status",
        "chain",
        "identities",
        "configuration",
        "core",
        "implementation",
        "governance",
        "source",
        "events"
      ],
      "properties": {
        "schemaVersion": {
          "const": 4
        },
        "installationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "const": "available"
        },
        "chain": {
          "$ref": "#/$defs/d2_chain"
        },
        "identities": {
          "$ref": "#/$defs/d4_identities"
        },
        "configuration": {
          "$ref": "#/$defs/d6_configuration"
        },
        "core": {
          "$ref": "#/$defs/d9_core"
        },
        "implementation": {
          "$ref": "#/$defs/d10_implementation"
        },
        "governance": {
          "$ref": "#/$defs/d11_governance"
        },
        "source": {
          "$ref": "#/$defs/d12_source"
        },
        "events": {
          "type": "array",
          "maxItems": 25,
          "items": {
            "$ref": "#/$defs/d14_event"
          }
        }
      }
    }
  },
  "$comment": "Public response structure from source snapshot 9e38b9313c9b4926ad15c7cd691d7f5789bdbc55. See endpoint notes for semantic constraints."
}
