{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://html.contact/schemas/webhook-v1.json",
  "title": "html.contact webhook v1",
  "type": "object",
  "required": [
    "schema_version",
    "id",
    "type",
    "timestamp",
    "data"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "id": {
      "type": "string"
    },
    "type": {
      "enum": [
        "submission.accepted",
        "integration.test"
      ]
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "data": {
      "type": "object",
      "required": [
        "form",
        "submission",
        "url"
      ],
      "properties": {
        "form": {
          "type": "object",
          "required": [
            "id",
            "name"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          }
        },
        "submission": {
          "type": "object",
          "required": [
            "id",
            "fields"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "fields": {
              "type": "object",
              "additionalProperties": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ]
              }
            }
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
