{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "quest": {
      "type": "string"
    },
    "test": {
      "type": "string"
    },
    "key": {
      "type": "string"
    },
    "program": {
      "type": "string"
    },
    "cluster": {
      "type": "string",
      "description": "mainnet or devnet"
    },
    "idlSource": {
      "type": "string",
      "description": "Where the IDL came from: file (--idl), program-metadata (the program's Program Metadata idl account) or anchor-idl-account (its legacy Anchor IDL account)"
    },
    "instruction": {
      "description": "The instruction checked; null for an account-state quest",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "account": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The account type read"
            },
            "field": {
              "type": "string",
              "description": "The integer field compared"
            },
            "type": {
              "type": "string",
              "description": "The field's IDL type, such as u64"
            },
            "seeds": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "wallet, pubkey, integer or string"
                  },
                  "setting": {
                    "description": "pubkey: the setting holding the address",
                    "type": "string"
                  },
                  "default": {
                    "description": "pubkey: the setting's default address",
                    "type": "string"
                  },
                  "type": {
                    "description": "integer: its type, such as u64",
                    "type": "string"
                  },
                  "value": {
                    "description": "integer and string: the seed, in the quest's code",
                    "type": "string"
                  }
                },
                "required": ["kind"]
              },
              "description": "The seeds of each account's address, in order"
            }
          },
          "required": ["name", "field", "type", "seeds"]
        },
        {
          "type": "null"
        }
      ],
      "description": "The account-state quest's account (--account); null for an instruction quest"
    },
    "settings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "argument": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "setting": {
            "type": "string"
          }
        },
        "required": ["argument", "type", "setting"]
      },
      "description": "The instruction's arguments the quest compares with a setting; for an account-state quest, each pubkey seed (argument \"seed <position>\") and the field compared with minimum"
    },
    "unchecked": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "argument": {
            "type": "string"
          },
          "type": {
            "$ref": "#/$defs/__schema0"
          }
        },
        "required": ["argument", "type"]
      },
      "description": "The arguments of other types, left as TODO comments in the quest; empty for an account-state quest"
    },
    "next": {
      "type": "string"
    }
  },
  "required": [
    "quest",
    "test",
    "key",
    "program",
    "cluster",
    "idlSource",
    "instruction",
    "account",
    "settings",
    "unchecked",
    "next"
  ],
  "additionalProperties": {},
  "title": "Quest written from an IDL",
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  }
}
