{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://formroost.com/docs/webhooks/schemas/submission.restored.v1.json",
  "title": "submission.restored.v1",
  "description": "CloudEvents 1.0 payload delivered when a submission is restored from archive, spam, or trash.",
  "type": "object",
  "required": [
    "specversion",
    "id",
    "source",
    "type",
    "datacontenttype",
    "dataschema",
    "time",
    "subject",
    "data"
  ],
  "properties": {
    "specversion": {
      "const": "1.0"
    },
    "id": {
      "type": "string"
    },
    "source": {
      "type": "string"
    },
    "type": {
      "const": "com.formroost.submission.restored.v1"
    },
    "datacontenttype": {
      "const": "application/json"
    },
    "dataschema": {
      "const": "/docs/webhooks/schemas/submission.restored.v1.json"
    },
    "time": {
      "type": "string",
      "format": "date-time"
    },
    "subject": {
      "type": "string"
    },
    "data": {
      "type": "object",
      "required": ["receiptId", "environment", "fields", "metadata", "restoredFrom"],
      "properties": {
        "receiptId": { "type": "string" },
        "environment": { "enum": ["sandbox", "production"] },
        "fields": {
          "type": "object",
          "additionalProperties": true
        },
        "metadata": {
          "type": "object",
          "additionalProperties": true
        },
        "restoredFrom": {
          "enum": ["archive", "spam", "trash"]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
