{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "$ref": "#/$defs/d0_publicUnavailable"
    },
    {
      "$ref": "#/$defs/d3_publicStateAvailable"
    }
  ],
  "$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"
    },
    "d6_decimal": {
      "type": "string",
      "format": "uint256-decimal"
    },
    "d7_bytes32": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{64}$"
    },
    "d5_chain": {
      "type": "object",
      "properties": {
        "target": {
          "enum": [
            "anvil",
            "sepolia",
            "mainnet"
          ]
        },
        "chainId": {
          "$ref": "#/$defs/d6_decimal"
        },
        "confirmations": {
          "const": "12"
        },
        "deploymentBlock": {
          "$ref": "#/$defs/d6_decimal"
        },
        "economyDeploymentBlock": {
          "$ref": "#/$defs/d6_decimal"
        },
        "indexedThroughBlock": {
          "$ref": "#/$defs/d6_decimal"
        },
        "safeThroughBlock": {
          "$ref": "#/$defs/d6_decimal"
        },
        "safeBlockHash": {
          "$ref": "#/$defs/d7_bytes32"
        },
        "safeBlockTimestamp": {
          "$ref": "#/$defs/d4_timestamp"
        }
      },
      "required": [
        "target",
        "chainId",
        "confirmations",
        "deploymentBlock",
        "economyDeploymentBlock",
        "indexedThroughBlock",
        "safeThroughBlock",
        "safeBlockHash",
        "safeBlockTimestamp"
      ],
      "additionalProperties": false
    },
    "d9_address": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{40}$"
    },
    "d8_identities": {
      "type": "object",
      "properties": {
        "core": {
          "$ref": "#/$defs/d9_address"
        },
        "tokenFactory": {
          "$ref": "#/$defs/d9_address"
        },
        "mining": {
          "$ref": "#/$defs/d9_address"
        },
        "token": {
          "$ref": "#/$defs/d9_address"
        },
        "collection": {
          "$ref": "#/$defs/d9_address"
        },
        "miningImplementation": {
          "$ref": "#/$defs/d9_address"
        },
        "miningImplementationVersion": {
          "$ref": "#/$defs/d6_decimal"
        },
        "miningStorageLayoutDigest": {
          "$ref": "#/$defs/d7_bytes32"
        }
      },
      "required": [
        "core",
        "tokenFactory",
        "mining",
        "token",
        "collection",
        "miningImplementation",
        "miningImplementationVersion",
        "miningStorageLayoutDigest"
      ],
      "additionalProperties": false
    },
    "d10_asset": {
      "type": "object",
      "properties": {
        "address": {
          "$ref": "#/$defs/d9_address"
        },
        "symbol": {
          "const": "SQK"
        },
        "decimals": {
          "const": 18
        }
      },
      "required": [
        "address",
        "symbol",
        "decimals"
      ],
      "additionalProperties": false
    },
    "d11_issuanceState": {
      "type": "object",
      "properties": {
        "mintedBaseUnits": {
          "$ref": "#/$defs/d6_decimal"
        },
        "tokenSupplyBaseUnits": {
          "$ref": "#/$defs/d6_decimal"
        },
        "unmintedCapacityBaseUnits": {
          "$ref": "#/$defs/d6_decimal"
        },
        "mintedThroughBlock": {
          "$ref": "#/$defs/d6_decimal"
        },
        "mintedThroughRound": {
          "$ref": "#/$defs/d6_decimal"
        },
        "lastAppliedRound": {
          "$ref": "#/$defs/d6_decimal"
        }
      },
      "required": [
        "mintedBaseUnits",
        "tokenSupplyBaseUnits",
        "unmintedCapacityBaseUnits",
        "mintedThroughBlock",
        "mintedThroughRound",
        "lastAppliedRound"
      ],
      "additionalProperties": false
    },
    "d12_collectionState": {
      "type": "object",
      "properties": {
        "phase": {
          "enum": [
            "unconfigured",
            "pending",
            "allowlist",
            "public",
            "closed"
          ]
        },
        "paused": {
          "type": "boolean"
        },
        "publicMinted": {
          "$ref": "#/$defs/d6_decimal"
        },
        "publicAllocation": {
          "$ref": "#/$defs/d6_decimal"
        },
        "reserveMinted": {
          "$ref": "#/$defs/d6_decimal"
        },
        "protocolReserve": {
          "$ref": "#/$defs/d6_decimal"
        },
        "publicPriceBaseUnits": {
          "$ref": "#/$defs/d6_decimal"
        },
        "allowlistStart": {
          "anyOf": [
            {
              "$ref": "#/$defs/d4_timestamp"
            },
            {
              "type": "null"
            }
          ]
        },
        "allowlistEnd": {
          "anyOf": [
            {
              "$ref": "#/$defs/d4_timestamp"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "phase",
        "paused",
        "publicMinted",
        "publicAllocation",
        "reserveMinted",
        "protocolReserve",
        "publicPriceBaseUnits",
        "allowlistStart",
        "allowlistEnd"
      ],
      "additionalProperties": false
    },
    "d3_publicStateAvailable": {
      "type": "object",
      "properties": {
        "schemaVersion": {
          "const": 2
        },
        "installationId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "status": {
          "const": "available"
        },
        "generatedAt": {
          "$ref": "#/$defs/d4_timestamp"
        },
        "release": {
          "$ref": "#/$defs/d1_release"
        },
        "chain": {
          "$ref": "#/$defs/d5_chain"
        },
        "identities": {
          "$ref": "#/$defs/d8_identities"
        },
        "asset": {
          "$ref": "#/$defs/d10_asset"
        },
        "issuance": {
          "$ref": "#/$defs/d11_issuanceState"
        },
        "collection": {
          "$ref": "#/$defs/d12_collectionState"
        }
      },
      "required": [
        "schemaVersion",
        "installationId",
        "status",
        "generatedAt",
        "release",
        "chain",
        "identities",
        "asset",
        "issuance"
      ],
      "additionalProperties": false
    }
  },
  "$comment": "Public response structure from source snapshot 9e38b9313c9b4926ad15c7cd691d7f5789bdbc55. See endpoint notes for semantic constraints."
}
