{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "$ref": "#/$defs/d0_publicUnavailable"
    },
    {
      "$ref": "#/$defs/d3_publicMetadataAvailable"
    }
  ],
  "$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_decimal": {
      "type": "string",
      "format": "uint256-decimal"
    },
    "d7_bytes32": {
      "type": "string",
      "pattern": "^0x[0-9a-f]{64}$"
    },
    "d6_chain": {
      "type": "object",
      "properties": {
        "target": {
          "enum": [
            "anvil",
            "sepolia",
            "mainnet"
          ]
        },
        "chainId": {
          "$ref": "#/$defs/d5_decimal"
        },
        "confirmations": {
          "const": "12"
        },
        "deploymentBlock": {
          "$ref": "#/$defs/d5_decimal"
        },
        "economyDeploymentBlock": {
          "$ref": "#/$defs/d5_decimal"
        },
        "indexedThroughBlock": {
          "$ref": "#/$defs/d5_decimal"
        },
        "safeThroughBlock": {
          "$ref": "#/$defs/d5_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/d5_decimal"
        },
        "miningStorageLayoutDigest": {
          "$ref": "#/$defs/d7_bytes32"
        }
      },
      "required": [
        "core",
        "tokenFactory",
        "mining",
        "token",
        "collection",
        "miningImplementation",
        "miningImplementationVersion",
        "miningStorageLayoutDigest"
      ],
      "additionalProperties": false
    },
    "d10_attribute": {
      "type": "object",
      "properties": {
        "traitType": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        }
      },
      "required": [
        "traitType",
        "value"
      ],
      "additionalProperties": false
    },
    "d3_publicMetadataAvailable": {
      "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"
        },
        "tokenId": {
          "$ref": "#/$defs/d5_decimal"
        },
        "chain": {
          "$ref": "#/$defs/d6_chain"
        },
        "identities": {
          "$ref": "#/$defs/d8_identities"
        },
        "collection": {
          "$ref": "#/$defs/d9_address"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048
        },
        "imageDataUri": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240000,
          "pattern": "^data:image/svg\\+xml;base64,[A-Za-z0-9+/]+=*$"
        },
        "cardImageUrl": {
          "type": "string",
          "pattern": "^https://[^\\s]{1,2048}$",
          "maxLength": 2048
        },
        "attributes": {
          "type": "array",
          "maxItems": 32,
          "items": {
            "$ref": "#/$defs/d10_attribute"
          }
        }
      },
      "required": [
        "schemaVersion",
        "release",
        "installationId",
        "status",
        "generatedAt",
        "tokenId",
        "chain",
        "identities",
        "collection",
        "name",
        "description",
        "attributes"
      ],
      "additionalProperties": false
    }
  },
  "$comment": "Public response structure from source snapshot 9e38b9313c9b4926ad15c7cd691d7f5789bdbc55. See endpoint notes for semantic constraints."
}
