{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "completion": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "quest": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "member": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "^[a-zA-Z0-9_-]+$"
    },
    "source": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "pattern": "^[a-zA-Z0-9_-]+$"
        }
      },
      "required": ["kind", "id"]
    },
    "restoredAt": {
      "type": "number"
    },
    "points": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "entry": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "balance": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "reversal": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "amount": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": ["entry", "balance", "reversal", "amount"]
      }
    },
    "badges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "badge": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          }
        },
        "required": ["badge"]
      }
    },
    "groups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "group": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "added": {
            "type": "boolean"
          }
        },
        "required": ["group", "added"]
      }
    },
    "entitlements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "entitlement": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "reward": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "outcome": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "status": {
            "type": "string"
          }
        },
        "required": ["entitlement", "reward", "outcome", "status"]
      }
    },
    "deliveries": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "delivery": {
            "type": "string"
          },
          "roleId": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": ["delivery", "roleId", "outcome"]
      }
    },
    "referrals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "program": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "outcome": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          }
        },
        "required": ["program", "outcome"]
      }
    },
    "streakMilestone": {
      "type": "boolean"
    },
    "budgets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "budget": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100,
            "pattern": "^[a-zA-Z0-9_-]+$"
          },
          "charged": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          }
        },
        "required": ["budget", "charged"]
      }
    }
  },
  "required": [
    "completion",
    "quest",
    "member",
    "restoredAt",
    "points",
    "badges",
    "groups",
    "entitlements",
    "deliveries",
    "referrals",
    "streakMilestone"
  ]
}
