{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "quest": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "pattern": "^[a-zA-Z0-9_-]+$"
      },
      "evaluatorProtocol": {
        "type": "number",
        "const": 2
      },
      "title": {
        "type": "string",
        "minLength": 1,
        "maxLength": 120
      },
      "presentation": {
        "default": {},
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "description": {
                  "type": "string",
                  "maxLength": 4000
                },
                "action": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "link"
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2000
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        }
                      },
                      "required": ["kind", "url", "label"],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "required": ["title"]
            }
          },
          "image": {
            "type": "string",
            "maxLength": 2000
          },
          "imageAlt": {
            "type": "string",
            "maxLength": 500
          },
          "requirements": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "account"
                    },
                    "provider": {
                      "type": "string",
                      "enum": ["google", "apple", "x", "discord"]
                    }
                  },
                  "required": ["kind", "provider"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "wallet"
                    },
                    "chain": {
                      "type": "string",
                      "enum": ["solana", "eip155", "cosmos"]
                    }
                  },
                  "required": ["kind"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "quiz": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "prompt": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "choices": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      },
                      "label": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": ["id", "label"]
                  }
                }
              },
              "required": ["id", "prompt", "choices"]
            }
          },
          "instructions": {
            "type": "string",
            "maxLength": 4000
          },
          "video": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "maxLength": 2000
              },
              "poster": {
                "type": "string",
                "maxLength": 2000
              },
              "captions": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "language": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 20
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": ["url", "language", "label"]
              }
            },
            "required": ["url"]
          }
        }
      },
      "integrations": {
        "default": [],
        "type": "array",
        "items": {
          "type": "string",
          "enum": ["discord", "x"]
        }
      },
      "integrationModules": {
        "type": "array",
        "items": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]{0,63}$"
        }
      },
      "fields": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "point-ledger"
                },
                "default": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    {
                      "type": "string",
                      "const": ""
                    }
                  ]
                }
              },
              "required": ["label", "kind", "default"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "datetime"
                },
                "default": {}
              },
              "required": ["label", "kind", "default"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "resource"
                },
                "default": {
                  "anyOf": [
                    {
                      "type": "string",
                      "const": ""
                    },
                    {
                      "type": "string",
                      "pattern": "^\\S{1,200}$"
                    }
                  ]
                },
                "source": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "provider": {
                          "type": "string",
                          "const": "domino"
                        },
                        "resource": {
                          "type": "string",
                          "const": "point-ledger"
                        }
                      },
                      "required": ["provider", "resource"]
                    },
                    {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "const": "discord"
                            },
                            "resource": {
                              "type": "string",
                              "const": "channel"
                            },
                            "types": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "enum": ["text", "announcement"]
                              }
                            },
                            "postable": {
                              "type": "boolean",
                              "const": true
                            }
                          },
                          "required": ["provider", "resource", "types"]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "provider": {
                              "type": "string",
                              "const": "discord"
                            },
                            "resource": {
                              "type": "string",
                              "const": "role"
                            },
                            "assignable": {
                              "default": false,
                              "type": "boolean"
                            }
                          },
                          "required": ["provider", "resource", "assignable"]
                        }
                      ]
                    }
                  ]
                }
              },
              "required": ["label", "kind", "default", "source"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "quiz"
                },
                "default": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "choices": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "maxLength": 100,
                              "pattern": "^[a-zA-Z0-9_-]+$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          },
                          "required": ["id", "label"]
                        }
                      },
                      "correct": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      }
                    },
                    "required": ["id", "prompt", "choices", "correct"]
                  }
                }
              },
              "required": ["label", "kind", "default"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "text"
                },
                "default": {
                  "type": "string"
                },
                "minLength": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "maxLength": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "multiline": {
                  "type": "boolean"
                },
                "picker": {
                  "type": "string"
                },
                "decimals": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "secret": {
                  "type": "boolean",
                  "const": true
                }
              },
              "required": [
                "label",
                "kind",
                "default",
                "minLength",
                "maxLength",
                "multiline"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "integer"
                },
                "default": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "min": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "max": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                }
              },
              "required": ["label", "kind", "default", "min", "max"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "boolean"
                },
                "default": {
                  "type": "boolean"
                }
              },
              "required": ["label", "kind", "default"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1
                },
                "description": {
                  "type": "string"
                },
                "kind": {
                  "type": "string",
                  "const": "choice"
                },
                "default": {
                  "type": "string"
                },
                "options": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                }
              },
              "required": ["label", "kind", "default", "options"],
              "additionalProperties": false
            }
          ]
        }
      },
      "values": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "maxLength": 100,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  },
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  },
                  "choices": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "maxLength": 100,
                          "pattern": "^[a-zA-Z0-9_-]+$"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        }
                      },
                      "required": ["id", "label"]
                    }
                  },
                  "correct": {
                    "type": "string",
                    "maxLength": 100,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  }
                },
                "required": ["id", "prompt", "choices", "correct"]
              }
            }
          ]
        }
      },
      "rewards": {
        "type": "array",
        "items": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "default": "points",
                  "type": "string",
                  "const": "points"
                },
                "balance": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "amount": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["kind", "balance", "amount"]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "tier"
                },
                "reward": {
                  "type": "object",
                  "properties": {
                    "badge": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    "group": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "tiers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 100,
                            "pattern": "^[a-zA-Z0-9_-]+$"
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          }
                        },
                        "required": ["id", "title"]
                      }
                    },
                    "inventory": {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "untracked"
                        }
                      },
                      "required": ["kind"]
                    },
                    "fulfillment": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "staff-handover"
                            }
                          },
                          "required": ["kind"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "automatic"
                            }
                          },
                          "required": ["kind"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "title",
                    "tiers",
                    "inventory",
                    "fulfillment"
                  ]
                },
                "tier": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                }
              },
              "required": ["kind", "reward", "tier"]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "integration"
                },
                "provider": {
                  "type": "string",
                  "const": "discord"
                },
                "action": {
                  "type": "string",
                  "const": "grant-role"
                },
                "roleId": {
                  "type": "string",
                  "pattern": "^[0-9]{1,20}$"
                }
              },
              "required": ["kind", "provider", "action", "roleId"]
            }
          ]
        }
      },
      "announcements": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "telegram"
                },
                "chat": {
                  "type": "string",
                  "pattern": "^-?[1-9][0-9]{0,19}$"
                },
                "action": {
                  "type": "string",
                  "const": "post-message"
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "replyToTriggeringMessage": {
                  "type": "boolean"
                }
              },
              "required": ["provider", "chat", "action", "text"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "discord"
                },
                "channel": {
                  "type": "string",
                  "pattern": "^[0-9]{1,20}$"
                },
                "action": {
                  "type": "string",
                  "const": "post-message"
                },
                "text": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 1000
                },
                "replyToTriggeringMessage": {
                  "type": "boolean"
                }
              },
              "required": ["provider", "channel", "action", "text"],
              "additionalProperties": false
            }
          ]
        }
      },
      "humanReview": {
        "type": "boolean"
      },
      "trigger": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "manual"
              },
              "input": {
                "type": "string",
                "const": "text"
              },
              "constraints": {
                "type": "object",
                "properties": {
                  "required": {
                    "default": true,
                    "type": "boolean"
                  },
                  "minLength": {
                    "default": 1,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "maxLength": {
                    "default": 10000,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["required", "minLength", "maxLength"]
              },
              "actor": {
                "type": "string",
                "enum": ["member", "staff"]
              }
            },
            "required": ["kind", "input", "constraints"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "manual"
              },
              "input": {
                "type": "string",
                "const": "url"
              },
              "constraints": {
                "type": "object",
                "properties": {
                  "required": {
                    "default": true,
                    "type": "boolean"
                  },
                  "allowedHosts": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 253
                    }
                  }
                },
                "required": ["required"]
              },
              "actor": {
                "type": "string",
                "enum": ["member", "staff"]
              }
            },
            "required": ["kind", "input", "constraints"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "manual"
              },
              "input": {
                "type": "string",
                "enum": ["photo", "quiz", "none"]
              },
              "actor": {
                "type": "string",
                "enum": ["member", "staff"]
              }
            },
            "required": ["kind", "input"]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "automatic"
              },
              "tracker": {
                "type": "object",
                "properties": {
                  "tracker": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100,
                    "pattern": "^[a-zA-Z0-9_-]+$"
                  },
                  "source": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "on": {
                    "type": "string",
                    "enum": ["new-record", "new-observation", "data-changed"]
                  },
                  "where": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string",
                                "maxLength": 200,
                                "pattern": "^[^.\\s]+(\\.[^.\\s]+)*$"
                              },
                              "equals": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 1000
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ]
                              }
                            },
                            "required": ["path", "equals"]
                          },
                          {
                            "type": "object",
                            "properties": {
                              "path": {
                                "type": "string",
                                "maxLength": 200,
                                "pattern": "^[^.\\s]+(\\.[^.\\s]+)*$"
                              },
                              "gt": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "setting": {
                                        "type": "string",
                                        "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                      }
                                    },
                                    "required": ["setting"]
                                  }
                                ]
                              },
                              "gte": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "setting": {
                                        "type": "string",
                                        "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                      }
                                    },
                                    "required": ["setting"]
                                  }
                                ]
                              },
                              "lt": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "setting": {
                                        "type": "string",
                                        "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                      }
                                    },
                                    "required": ["setting"]
                                  }
                                ]
                              },
                              "lte": {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "setting": {
                                        "type": "string",
                                        "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                      }
                                    },
                                    "required": ["setting"]
                                  }
                                ]
                              }
                            },
                            "required": ["path"]
                          }
                        ]
                      },
                      {
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "maxLength": 200,
                                  "pattern": "^[^.\\s]+(\\.[^.\\s]+)*$"
                                },
                                "equals": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 1000
                                    },
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "boolean"
                                    }
                                  ]
                                }
                              },
                              "required": ["path", "equals"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "maxLength": 200,
                                  "pattern": "^[^.\\s]+(\\.[^.\\s]+)*$"
                                },
                                "gt": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "setting": {
                                          "type": "string",
                                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                        }
                                      },
                                      "required": ["setting"]
                                    }
                                  ]
                                },
                                "gte": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "setting": {
                                          "type": "string",
                                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                        }
                                      },
                                      "required": ["setting"]
                                    }
                                  ]
                                },
                                "lt": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "setting": {
                                          "type": "string",
                                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                        }
                                      },
                                      "required": ["setting"]
                                    }
                                  ]
                                },
                                "lte": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "setting": {
                                          "type": "string",
                                          "pattern": "^[a-zA-Z][a-zA-Z0-9_]*$"
                                        }
                                      },
                                      "required": ["setting"]
                                    }
                                  ]
                                }
                              },
                              "required": ["path"]
                            }
                          ]
                        }
                      }
                    ]
                  },
                  "beneficiary": {
                    "type": "string",
                    "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,39}$"
                  },
                  "enrollment": {
                    "type": "string",
                    "enum": ["none", "required"]
                  },
                  "since": {
                    "type": "string",
                    "enum": ["activation", "window", "enrollment"]
                  },
                  "historical": {
                    "type": "string",
                    "enum": ["staff", "claim", "automatic"]
                  },
                  "content": {
                    "type": "boolean",
                    "const": true
                  }
                },
                "required": ["tracker", "source", "on", "beneficiary"]
              }
            },
            "required": ["kind"]
          }
        ]
      },
      "performance": {
        "type": "object",
        "properties": {
          "metrics": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[a-z][a-zA-Z0-9]{0,39}$"
            }
          },
          "maxAgeMs": {
            "default": 3600000,
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["metrics", "maxAgeMs"]
      },
      "requires": {
        "default": [],
        "type": "array",
        "items": {
          "oneOf": [
            {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "completion"
                    },
                    "quest": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    "scope": {
                      "type": "string",
                      "const": "ever"
                    }
                  },
                  "required": ["kind", "quest", "scope"],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "completion"
                    },
                    "quest": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 100,
                      "pattern": "^[a-zA-Z0-9_-]+$"
                    },
                    "scope": {
                      "type": "string",
                      "const": "period"
                    },
                    "period": {
                      "type": "string",
                      "enum": ["day", "week", "month"]
                    }
                  },
                  "required": ["kind", "quest", "scope", "period"],
                  "additionalProperties": false
                }
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "balance"
                },
                "balance": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "minimum": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": ["kind", "balance", "minimum"],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "group"
                },
                "group": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 100,
                  "pattern": "^[a-zA-Z0-9_-]+$"
                },
                "title": {
                  "type": "string"
                }
              },
              "required": ["kind", "group", "title"],
              "additionalProperties": false
            }
          ]
        }
      },
      "campaign": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "window": {
            "type": "object",
            "properties": {
              "from": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "until": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": ["from", "until"]
          },
          "enrollment": {
            "default": "none",
            "type": "string",
            "enum": ["none", "required"]
          }
        },
        "required": ["key", "title", "enrollment"]
      },
      "availability": {
        "type": "object",
        "properties": {
          "from": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "until": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["from", "until"]
      },
      "completion": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "streak"
              },
              "days": {
                "type": "integer",
                "minimum": 1,
                "maximum": 9007199254740991
              }
            },
            "required": ["kind", "days"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "progress"
              },
              "goal": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "count"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["kind", "count"]
              },
              "window": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "lifetime"
                      }
                    },
                    "required": ["kind"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "calendar"
                      },
                      "period": {
                        "type": "string",
                        "enum": ["day", "week", "month"]
                      },
                      "latenessMs": {
                        "default": 604800000,
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["kind", "period", "latenessMs"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "rolling"
                      },
                      "durationMs": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": ["kind", "durationMs"],
                    "additionalProperties": false
                  }
                ]
              },
              "repeat": {
                "default": "once",
                "type": "string",
                "enum": ["once", "repeat"]
              }
            },
            "required": ["kind", "goal", "window", "repeat"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "once"
              }
            },
            "required": ["kind"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "keyed"
              },
              "across": {
                "type": "string",
                "const": "members"
              }
            },
            "required": ["kind"],
            "additionalProperties": false
          }
        ]
      },
      "visibility": {
        "default": "visible",
        "type": "string",
        "enum": ["visible", "hidden"]
      },
      "profile": {
        "default": {
          "visible": false
        },
        "type": "object",
        "properties": {
          "visible": {
            "type": "boolean"
          }
        },
        "required": ["visible"]
      },
      "budgets": {
        "default": [],
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
            },
            "scope": {
              "type": "string",
              "enum": ["member", "project"]
            },
            "period": {
              "type": "string",
              "enum": ["lifetime", "day", "week", "month"]
            },
            "limit": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "cost": {
              "anyOf": [
                {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
                    }
                  },
                  "required": ["balance"]
                }
              ]
            }
          },
          "required": ["id", "scope", "period", "limit", "cost"]
        }
      },
      "authorBudgets": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
            },
            "scope": {
              "type": "string",
              "const": "author"
            },
            "period": {
              "type": "string",
              "enum": ["lifetime", "day", "week", "month"]
            },
            "limit": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "cost": {
              "anyOf": [
                {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
                    }
                  },
                  "required": ["balance"]
                }
              ]
            }
          },
          "required": ["id", "scope", "period", "limit", "cost"]
        }
      },
      "retryCooldownMs": {
        "type": "integer",
        "minimum": 1000,
        "maximum": 9007199254740991
      },
      "completionCooldownMs": {
        "type": "integer",
        "minimum": 1000,
        "maximum": 9007199254740991
      },
      "rewardEntries": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "type": {
              "type": "string"
            },
            "data": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/__schema0"
              }
            }
          },
          "required": ["type", "data"]
        }
      },
      "key": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "pattern": "^[a-zA-Z0-9_-]+$"
      },
      "code": {
        "type": "string"
      },
      "runtime": {
        "type": "object",
        "properties": {
          "digest": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "sdkVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": ["digest", "sdkVersion"]
      },
      "provider": {
        "type": "string",
        "enum": [
          "fixture-pass",
          "fixture-fail",
          "fixture-unclear",
          "fixture-error",
          "workers-ai"
        ]
      },
      "id": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100,
        "pattern": "^[a-zA-Z0-9_-]+$"
      },
      "createdAt": {
        "type": "number"
      },
      "origin": {
        "type": "object",
        "properties": {
          "typeVersion": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          }
        },
        "required": ["typeVersion"]
      },
      "lifecycle": {
        "default": "active",
        "type": "string",
        "enum": ["active", "paused", "archived"]
      },
      "configuration": {
        "type": "object",
        "properties": {
          "defaults": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "choices": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "maxLength": 100,
                              "pattern": "^[a-zA-Z0-9_-]+$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          },
                          "required": ["id", "label"]
                        }
                      },
                      "correct": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      }
                    },
                    "required": ["id", "prompt", "choices", "correct"]
                  }
                }
              ]
            }
          },
          "overrides": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "choices": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "maxLength": 100,
                              "pattern": "^[a-zA-Z0-9_-]+$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            }
                          },
                          "required": ["id", "label"]
                        }
                      },
                      "correct": {
                        "type": "string",
                        "maxLength": 100,
                        "pattern": "^[a-zA-Z0-9_-]+$"
                      }
                    },
                    "required": ["id", "prompt", "choices", "correct"]
                  }
                }
              ]
            }
          },
          "preserved": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "object",
            "properties": {
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 4000
                    },
                    "action": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "link"
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": ["kind", "url", "label"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": ["title"]
                }
              },
              "image": {
                "type": "string",
                "maxLength": 2000
              },
              "imageAlt": {
                "type": "string",
                "maxLength": 500
              },
              "requirements": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "account"
                        },
                        "provider": {
                          "type": "string",
                          "enum": ["google", "apple", "x", "discord"]
                        }
                      },
                      "required": ["kind", "provider"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "wallet"
                        },
                        "chain": {
                          "type": "string",
                          "enum": ["solana", "eip155", "cosmos"]
                        }
                      },
                      "required": ["kind"],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "presentationDefaults": {
            "type": "object",
            "properties": {
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 4000
                    },
                    "action": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "link"
                            },
                            "url": {
                              "type": "string",
                              "maxLength": 2000
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": ["kind", "url", "label"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": ["title"]
                }
              },
              "image": {
                "type": "string",
                "maxLength": 2000
              },
              "imageAlt": {
                "type": "string",
                "maxLength": 500
              },
              "requirements": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "account"
                        },
                        "provider": {
                          "type": "string",
                          "enum": ["google", "apple", "x", "discord"]
                        }
                      },
                      "required": ["kind", "provider"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "kind": {
                          "type": "string",
                          "const": "wallet"
                        },
                        "chain": {
                          "type": "string",
                          "enum": ["solana", "eip155", "cosmos"]
                        }
                      },
                      "required": ["kind"],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          }
        },
        "required": ["defaults", "overrides", "preserved"]
      },
      "solanaIdls": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "object",
          "properties": {
            "program": {
              "type": "string"
            },
            "source": {
              "type": "string"
            },
            "idl": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/__schema1"
              }
            }
          },
          "required": ["program", "source", "idl"]
        }
      },
      "withheldSettings": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "quest",
      "evaluatorProtocol",
      "title",
      "presentation",
      "integrations",
      "fields",
      "values",
      "rewards",
      "humanReview",
      "trigger",
      "requires",
      "completion",
      "visibility",
      "profile",
      "budgets",
      "code",
      "provider",
      "id",
      "createdAt",
      "lifecycle"
    ]
  },
  "$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"
          }
        }
      ]
    },
    "__schema1": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema1"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema1"
          }
        }
      ]
    }
  }
}
